我想把这个书店的问候语打印在两行第一行“hallo”第二行“Cecil”上
for x in range(3,8,2):
print(x)
system = 'bookstore'
greeting = 'Hallo, welcome to ' + str(system)
Cecil = " I'm Cecil let me know if you need help finding anything"
hallo = greeting
print('hallo' \n + 'Cecil')
当我在pycharm中运行它的时候,我得到了这个
hallo n\ Cecil
我希望它像这样打印:
你好,欢迎光临书店
我是塞西尔,如果你需要帮助找什么请告诉我
发布于 2019-07-24 00:08:14
system = 'bookstore'
greeting = 'Hallo, welcome to {}'.format(system)
Cecil = " I'm Cecil let me know if you need help finding anything"
hallo = greeting
print('{}\n{}'.format(hallo, Cecil))
Hallo, welcome to bookstore
I'm Cecil let me know if you need help finding anything发布于 2019-07-24 00:39:34
print(f"{greeting}\n{Cecil}") # f-string
# or
print(greeting + "\n" + Cecil) # concatenation这两个选项都将输出您想要的内容。f"{variable}"与"{}".format(variable)相同
发布于 2019-07-24 04:04:07
以下代码:
for x in range(3,8,2):
print(x)
system = 'bookstore'
greeting = 'Hallo, welcome to ' + str(system)
Cecil = "I'm Cecil let me know if you need help finding anything"
hallo = greeting
print(hallo + '\n' + Cecil)生成以下输出:
3
5
7
Hallo, welcome to bookstore
I'm Cecil let me know if you need help finding anythinghttps://stackoverflow.com/questions/57168185
复制相似问题