python的对齐方式

python的对齐方式,第1张

python的对齐方式
 fout = open(sub_file, 'a+', encoding='utf-8') #sub_file is a file path
 #Open","Hi","Lo","Close","MA5","MA10六个字符串以宽度为10,左对齐的方式写入sub_file
fout.write('%-10s%-10s%-10s%-10s%-10s%-10s' % ("Open","Hi","Lo","Close","MA5","MA10"))
#Open","Hi","Lo","Close","MA5","MA10六个字符串以宽度为10,右对齐的方式写入sub_file
# fout.write('%10s%10s%10s%10s%10s%10s' % ("Open","Hi","Lo","Close","MA5","MA10"))

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/916002.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存