raw_input

rzed rzantow at ntelos.net
Wed Apr 21 10:53:18 EDT 2004


Marcello Pietrobon <teiffel at attglobal.net> wrote in
news:mailman.779.1082425126.20120.python-list at python.org: 

>         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 )
> 
> 

1. lower()(not lower) invokes the method
2. with that change, this code works as expected when I run it form a 
win2k command line, from an interactive session, or from Idle.

-- 
rzed




More information about the Python-list mailing list