Jump to content

Pyhton input

Wictorian

If input is enter, I wanna skip, else I wanna execute some code. How can I do this?

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Wictorian said:

If input is enter, I wanna skip, else I wanna execute some code. How can I do this?

userInput = input()
if(len(userInput)):
    # userInput isn't empty, do your stuff here.
    # userInput will be empty, if user just simply pressed Enter, in which case this stuff never happens.
    print(userInput)

 

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×