raw_input

Marcello Pietrobon teiffel at attglobal.net
Mon Apr 19 21:38:42 EDT 2004


Hello,
even if I learned something about Python,
still I don't know how to do ask the input from a user on the command line

This is my ( not working ) code:
        if ( not os.path.exists( dirname) ):
            msg = 'The directory \'%s\' does not exist. Create it [y/n] 
?' % dirname
            c = raw_input( msg ).lower
            if ( c == 'y' or c == 'yes' ):
                os.makedirs( dirname)
            else:
                raise Exception( 'directory \'%s\' not created, 
impossible to continue !' % dirname )


Thank you for any answers,
Marcello






More information about the Python-list mailing list