更新时间:2023-11-28 16:46:22
拆分换行符并以您的格式输出:
Splitting on newlines and outputting in your format:
from ast import literal_eval
file_contents = file.readlines() #read the file as lines
for line in file_contents:
l = literal_eval(line) #convert the string to a list
print(''.join([v.ljust(10, ' ') for v in l])) #left justify and print