为了账号安全,请及时绑定邮箱和手机立即绑定

两个字符串没有做到换行

s = 'Python was started in 1989 by \"Guido\".\n','Python is free and easy to learn.' print s

为什么这个语句的输出形式是这个

('Python was started in 1989 by "Guido".\n', 'Python is free and easy to learn.')

我的想法是输出两个字符串,第一个字符串打印之后用\n换行,不知道为什么却做不了

正在回答

3 回答

直接把这两句放在一个单引号里面就行了啊

0 回复 有任何疑惑可以回复我~

s = 'Python was started in 1989 by \"Guido\",\n,''Python is free and easy to learn.'
print s

这样可以换行,不知道你在\n后面加一个逗号是什么意思。逗号不要再外面。

0 回复 有任何疑惑可以回复我~
#1

慕粉3676168

他想用逗号作为连接符将两段话连接起来。 我试了用逗号不能连接。 改成'Python was started in 1989 by \"Guido\".\n'+'Python is free and easy to learn.' 就可以。
2016-07-17 回复 有任何疑惑可以回复我~

哦哦,自己看出来了,这是变量输出,不是直接print输出

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
初识Python
  • 参与学习       758357    人
  • 解答问题       8967    个

学python入门视频教程,让你快速入门并能编写简单的Python程序

进入课程

两个字符串没有做到换行

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号