print的格式问题

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_33598125/article/details/102724550
print ("{0:<10}{1:>5}".format(word, count))

格式控制:

  • {0:<10}表示word左对齐占10个位置
  • {1:>5}表示count右对齐占5个位置

其中<表示左对齐

猜你喜欢

转载自blog.csdn.net/qq_33598125/article/details/102724550
今日推荐