用于' '.join()通过空格加入您的列表。和 '\n' 进行换行尝试这个:A= ['1', '2', '3', '4', '5'] # your listsB= ['6', '7', '8', '9', '10']f = open("filename.txt","w+") # create your filef.write(' '.join(A)) # write list A to your filef.write('\n') # line breakf.write(' '.join(B)) # write list B to your file文件名.txt:1 2 3 4 56 7 8 9 10