[英]How do I take input from a user, store it in an empty variable and print the variable?
Here is my code:这是我的代码:
name = ' '
Nameval = name("Enter the victims IP address: ")
print("Hello, " + name)
I want this code to take the input from Nameval, store it in the "name" variable and then print the name variable.我希望此代码从 Nameval 获取输入,将其存储在“name”变量中,然后打印 name 变量。 However, it wont work.
但是,它不会工作。 How can I do this?
我怎样才能做到这一点?
You need to use input([prompt])
.您需要使用
input([prompt])
。
name = input("Enter the victims IP address: ")
print("Hello, " + name)
Your code is wrong.你的代码是错误的。 You are not asking for an input, try this.
你不是要求输入,试试这个。
name = input('Enter IP address: ')
print(f'Hello {name}')
F string are better than concatination F 字符串优于连接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.