问题遇到的现象和发生背景
看f-string的使用方式时,无法理解案例使用的数据格式。
https://docs.python.org/3/tutorial/inputoutput.html
在7.1. Fancier Output Formatting里第二个代码块,如下
问题相关代码
yes_votes = 42_572_654
no_votes = 43_132_495
percentage = yes_votes / (yes_votes + no_votes)
'{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)
输出结果为:
' 42572654 YES votes 49.67%'
我的疑惑
42_572_654这是数值?看样子就等同于42572654?
这是什么特殊的数字类型吗?为什么要加下划线?
感谢解答!