Reputation: 105
I have this code:
from Tools.scripts.treesync import raw_input
username = raw_input("Enter Username : ")
password = raw_input("Enter Password : ")
if username == "bert" and password == "peter":
print("Logged in")
and i want it to say logged in
but it doesn't say anything. It just won't accept anything I'm doing, does anyone know the answer?
(started today so it can be a small fix)
EDIT: it should have been input
instead of raw_input
Upvotes: 3
Views: 501
Reputation: 2642
No need to import anything. Also raw_input was changed to input in Python 3. So
Your_variable = input("Enter input:")
Would do good.
If you want to use raw_input functionality in Python 3 then use
eval(input())
Difference between them previously.
If you enter 5 to input It takes the value, finds it type and stores it as an integer
A = input("Enter :")
Where as raw_input stored it as a string
This has changed now so simply use input. And if you want to store anything as an integer . Just use this.
a = int(input("Enter value: "))
Upvotes: 2
Reputation: 81
raw_input is a built-in function, you don't need to import anything. Just delete the first line and run it again.
Upvotes: 0