Python 3.x 尝试将用户输入的结果添加到字符串中

Python 3.x 尝试将用户输入的结果添加到字符串中,python-3.x,Python 3.x,所以我对python非常陌生,只是在尝试让用户输入一些东西,然后输出 “你的名字是x,你已经x岁了,你是x!” 然而,我只能把它作为 你的名字是零,你没有一岁,你的工作是一个零 这是我的密码 myName = print(input('Please enter your name: ')) myAge = print(input('Please enter your age: ')) myJob = print(input('Please enter your job: ')) print('

所以我对python非常陌生,只是在尝试让用户输入一些东西,然后输出

“你的名字是x,你已经x岁了,你是x!”

然而,我只能把它作为

你的名字是零,你没有一岁,你的工作是一个零

这是我的密码

myName = print(input('Please enter your name: '))
myAge = print(input('Please enter your age: '))
myJob = print(input('Please enter your job: '))

print('Your name is {0}, You are {1} years old and you work as a {2}!'.format(myName, myAge, myJob))
非常感谢您的帮助。

myName=print(输入('请输入您的姓名:'))
print()
在这里是不必要的

myName=input('请输入您的姓名:')
print('您的名字是{},您是{}岁,您以{}格式工作(myName,myAge,myJob))

应该可以工作。

您不需要使用print(),因为print()不返回值,它只在控制台中输出一个字符串:

myName = input('Please enter your name: ')
myAge = input('Please enter your age: ')
myJob = input('Please enter your job: ')

print('Your name is {0}, You are {1} years old and you work as a {2}!'.format(myName, 
myAge, myJob))

删除代码中的
print
,它会很好地工作,这很有意义。