简体   繁体   中英

What is this error ? ValueError invalid literal for int() with base 10: ''

I have an error with my code. When I run this code and I define "email" , Pycharm indicates an error.

ValueError: invalid literal for int() with base 10: 'mymail'
email = str(input("Define your email adress. "))
key_password = int(input("Define your password. "))

login = int(input("Input your email adress. "))
enter_password = int(input("Input your password. "))

if email == login and  key_password == enter_password:
    print("Welcome to your member space.")
elif email == login and  key_password != enter_password:
    print("Wrong password.")
elif email != login and  key_password == enter_password:
    print("Wrong email adress.")
else:
    print("Wrong email adress and password.")

I'm guessing your error comes from here:

login = int(input("Input your email adress. "))

You're trying to interpret your input as an int when it will probably be an email address. Maybe you meant to do the following?

login = str(input("Input your email adress. "))

As the comments indicated the str() here is redundant since input() returns a string. So you could just do:

login = input("Input your email adress. ")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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