怎么加逗号啊

name = 'Eric'
print('Hello ' + name, "woule you like to learn some Python today?")
Hello Eric woule you like to learn some Python today?
想要变成
Hello Eric,woule you like to learn some Python today?
怎么办


请先 登录 后评论

5 个回答

欧阳平静
  1. name = 'Eric'
  2. print('Hello ' +str(name)+','+"woule you like to learn some Python today?")
复制代码
请先 登录 后评论
桔沫
变量值:
>>> name = 'Eric'

输出时:
>>> print('Hello %s, would you like to learn some Python today?' %name)
Hello Eric, would you like to learn some Python today?

或者
>>> print('Hello {}, would you like to learn some Python today?'.format(name))
Hello Eric, would you like to learn some Python today?

请先 登录 后评论
白沐沐
想要逗号就写个逗号进去吧. 编程要敢于尝试
请先 登录 后评论
恋狼
1. name = 'Eric,'
或者
2. print('Hello ' + name +  ",woule you like to learn some Python today?")
请先 登录 后评论
木子丶簫
谢谢你们
请先 登录 后评论
  • 5 关注
  • 0 收藏,619 浏览
  • Gui銘 提出于 2021-09-11 21:30

相似问题