使用更新的
str.format语法尝试这种方法:
line_new = '{:>12} {:>12} {:>12}'.format(word[0], word[1], word[2])以下是使用旧
%语法(对不支持的旧版Python有用
str.format)的方法:
line_new = '%12s %12s %12s' % (word[0], word[1], word[2])

使用更新的
str.format语法尝试这种方法:
line_new = '{:>12} {:>12} {:>12}'.format(word[0], word[1], word[2])以下是使用旧
%语法(对不支持的旧版Python有用
str.format)的方法:
line_new = '%12s %12s %12s' % (word[0], word[1], word[2])