我想在字符串中打印变量,该变量是由用户写的
name = input('enter the name of the coustomer : ',),
days = int(input('enter the number of days for :'))
我想在文本输入(名称)的天数后打印名称(由用户输入)
name = input('enter the name of the coustomer : ',),
days = int(input('enter the number of days for :'))
I want to print name after the text enter the number of days for (name) (type by user )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有一个由内置函数
input
给出的str
类型的name
变量。您可以使用内置函数
print
打印它。您可以将
name
变量与f-string
一起使用:即使这是最佳实践,
f-string
也不是在 Python 中格式化string
的唯一方法,并且如果您希望它适用于早于 < code>3.6,你可以这样做:Here you have a
name
variable of typestr
given by the built-in functioninput
.You can print it with the built-in function
print
.You can re-use the
name
variable with anf-string
:Even if it's the best practice,
f-string
isn't the only way to format astr
ing in Python, and if you want it to work for versions older than3.6
, you can do something like this: