Discuss / Python / 运行没问题,除了第一行别的都有首行缩进一格,为啥呀

运行没问题,除了第一行别的都有首行缩进一格,为啥呀

Topic source

print('n=123\n','f=456.789\n','s1=\'Hello,world\'\n','s2 =\'Hello,','\\\'Adam\\\'\'\n','s3=r\'Hello,','\"Bart\"\'\n','s4=r\'\'\'Hello,\n','Lisa!\'\'\'')

逗号的问题;、逗号默认是空一格

我感觉你把题目理解错了,是让打印这些变量的值,而不是让打印出这些句子,应该输入a=123 空格换行    print(a)   显示结果为123

世界之风7

#4 Created at ... [Delete] [Delete and Lock User]

# -*- coding: utf-8 -*-

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')

谢谢大佬们的解答!俺明白一点了,感谢!


  • 1

Reply