how to check if user pressed enter in python

Solutions on MaxInterview for how to check if user pressed enter in python by the best coders in the world

showing results for - "how to check if user pressed enter in python"
Natalia
15 Sep 2017
1# credit to the Stack Overflow user in source link
2
3text = input("type in enter")  # or raw_input in python2
4if text == "":
5    print("you pressed enter")
6else:
7    print("you typed some text before pressing enter")