print 高级用法
Posted liangliangzz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了print 高级用法相关的知识,希望对你有一定的参考价值。
my_name=‘zhangsan‘ print(f"Let‘s talk {my_name},Don‘t paly basketball in the room") #等价于下面方式 print("Let‘s talk {},Don‘t paly basketball in the room".format(my_name)) #打印结果如下: ‘‘‘ Let‘s talk zhangsan,Don‘t paly basketball in the room Let‘s talk zhangsan,Don‘t paly basketball in the room ‘‘‘ #当然想打印出这个相同的结果还有好多种方法 print("Let‘s talk %s,Don‘t paly basketball in the room"%my_name) print("Let‘s talk "+my_name+",Don‘t paly basketball in the room") ‘‘‘ Let‘s talk zhangsan,Don‘t paly basketball in the room Let‘s talk zhangsan,Don‘t paly basketball in the room ‘‘‘
以上是关于print 高级用法的主要内容,如果未能解决你的问题,请参考以下文章