你可以用这个:
with open("tasks.txt", 'r') as data: data=[int(each_int) for ele in data.readlines() for each_int in ele.split() ]
打印(数据)