python怎么用一个print换行输出多个变量

时间:2020-05-28 22:10:44   收藏:0   阅读:273

1.用链表加循环的方式

n=123
f=456.456
s1=‘Hello,world‘
s2=‘Hello,\‘lihua\‘‘
s3=r‘hello,"Bart"‘
s4=r‘‘‘hello
Lisa!‘‘‘
L=[n,f,s1,s2,s3,s4]
for M in L:
    print(M)

 2.用sep=‘\n‘

n=123
f=456.456
s1=‘Hello,world‘
s2=‘Hello,\‘lihua\‘‘
s3=r‘hello,"Bart"‘
s4=r‘‘‘hello
Lisa!‘‘‘
print(n,f,s1,s2,s3,s4,sep=‘\n‘)

  

 

原文:https://www.cnblogs.com/Zhuohome/p/12983768.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!