码迷,mamicode.com
首页 > 其他好文 > 详细

print 高级用法

时间:2019-10-21 11:37:56      阅读:61      评论:0      收藏:0      [点我收藏+]

标签:int   打印   高级用法   oom   结果   方法   mat   name   col   

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 高级用法

标签:int   打印   高级用法   oom   结果   方法   mat   name   col   

原文地址:https://www.cnblogs.com/liangliangzz/p/11712124.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!