User Input

Fábio Santos fabiosantosart at gmail.com
Thu May 30 07:45:43 EDT 2013


On 30 May 2013 12:42, "Eternaltheft" <eternaltheft at gmail.com> wrote:
>
> Hi, I'm having trouble oh how prompt the user to enter a file name and
how to set up conditions. For example, if there's no file name input by the
user, a default is returned

Are you using raw_input? It returns an empty string if the user enters
nothing, so you can just use an if.

filename = raw_input('file name: ')
if not filename:
    filename = 'your default'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130530/c844b01d/attachment.html>


More information about the Python-list mailing list