![](/img/trans.png)
[英]How do i take user input from discord and store it as a variable to use in an equation? Discord.py
[英]How do I take input from a user, store it in an empty variable and print the variable?
這是我的代碼:
name = ' '
Nameval = name("Enter the victims IP address: ")
print("Hello, " + name)
我希望此代碼從 Nameval 獲取輸入,將其存儲在“name”變量中,然后打印 name 變量。 但是,它不會工作。 我怎樣才能做到這一點?
您需要使用input([prompt])
。
name = input("Enter the victims IP address: ")
print("Hello, " + name)
你的代碼是錯誤的。 你不是要求輸入,試試這個。
name = input('Enter IP address: ')
print(f'Hello {name}')
F 字符串優於連接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.