![]() |
Problem with slicing string - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem with slicing string (/thread-3003.html) |
Problem with slicing string - YatishK - Apr-24-2017 Can you help me figure out what is the issue in the below code. My Code: email = input("What is your email add: ") #UN = email[:email.index("@")] print(email)Error: >>> ================================ RESTART ================================ >>> What is your email add: asdasdasdasdasdasd >>>
RE: Problem with slicing string - wavic - Apr-24-2017 Use raw_input() instead of input() Python 2 ? Python 2 see the input() returns as a valid Python statement/code. So there is no variable called 'asdasdasdasdasdasd' and you get an error. RE: Problem with slicing string - YatishK - Apr-24-2017 Yes 2.7 version. raw_input worked. Thanks! |