简体   繁体   English

(新)关于用户输入的python问题

[英](new) python questions about user input

Okay so i have a question on user input, this is fairly simple and i'm new so..I'm using python 3.3 and if i were to type 好的,所以我对用户输入有疑问,这很简单,我是新手。.我正在使用python 3.3,如果要输入

input("Enter name and age: ")

How do i put together an if statement that records the name and age and tells the user: 我如何将记录姓名和年龄并告诉用户的if语句放在一起:

print("Your name is this and your age is that")

with the values that they inserted, PS, I'm using notepad++ as the IDE and cmd to enter the input for the code. 使用他们插入的值PS,我使用notepad ++作为IDE,并使用cmd输入代码输入。 So no python shells. 因此没有python shell。 Thanks in advance, please explain in detail how your answers work because i'm fairly new to python, I've been scripting on actionscript before but it was too outdated so i know a few things or 2 about loops but i never really scripted input data which can be recorded. 在此先感谢您,请详细解释您的答案的工作方式,因为我对python还是很陌生,我以前在actionscript上编写过脚本,但是它已经过时了,所以我对循环有几点了解或了解2点,但我从未真正编写过脚本可以记录的数据。

Thanks in advance . 提前致谢 。

name, age = input("Enter name and age: ").split()
print("Your name is {this} and your age is {that}".format(this=name, that=age))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM