Raw_Input is gone :(

0 Jim Fp · August 22, 2015
My question is: How can i get a string from user? Not a char or a number
Here is what i do. I am creating a command-line like application.
it runs forever till its breaked. So i type

command = input()

and then i check it with if statements.

if x is 'PrintDate':
                   printdate()
else:
    print('Else')

That Doesnt work it always go to else section and prints 'Else'

Post a Reply

Replies

Oldest  Newest  Rating
0 Halcyon Abraham Ramirez · August 22, 2015
you stored the input in a command variable so your code should be


if command == 'PrintDate':
    printdate()
else:
    print('Else')
0 Mathew Clutter · August 23, 2015
input automatically stores strings
  • 1

Python

107,287 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator