Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.116 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.77; '*S*': 0.00; 'string': 0.09; 'filename': 0.09; 'cc:addr:python-list': 0.11; 'wrote:': 0.18; 'input': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'returned': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; 'trouble': 0.34; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'received:google.com': 0.35; 'hi,': 0.36; 'example,': 0.37; 'received:209': 0.37; 'conditions.': 0.38; 'skip:& 20': 0.39; '\xa0\xa0\xa0': 0.39; 'how': 0.40; 'name:': 0.61; 'name': 0.63; 'to:addr:gmail.com': 0.65; 'prompt': 0.68; 'default': 0.69; 'user,': 0.69; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=IlgxZIkY3/cRvgZZ+0BMA/qsYiF4xq/+9psEkPa4DmA=; b=xls36wPDiu9xK7GlQh8inARbiAfymXo/o8lpOKWoildoFSxy7cGcENHSkWfDHtr+IK zcwOM2GxhZXTIGSblSkw44wkFajmmi3pHhW3o6oRoRhHnOo7dTOoULhg3nefX6JD4Oks Adi5A3GekhPAGMDKwOvJXTQv+9VWjuD4uQQDPs1vDQD6fvQ7XFaZ4nkbdZUV8jaPTtln zIUhbJSt6+1kNUTZHE59QB2SWLYqStPpCzo/YYNaKdEyVOw3Wjf88RFWDZpN/Ij+a4w6 MI6qu69/s6lScVeDSsg638nvga34uvaoyrMWZnhDtrtphktIZurDdEM27J1BoF+3JWM7 I80Q== MIME-Version: 1.0 X-Received: by 10.52.157.138 with SMTP id wm10mr4314028vdb.57.1369914343549; Thu, 30 May 2013 04:45:43 -0700 (PDT) In-Reply-To: References: Date: Thu, 30 May 2013 12:45:43 +0100 Subject: Re: User Input From: =?ISO-8859-1?Q?F=E1bio_Santos?= To: Eternaltheft Content-Type: multipart/alternative; boundary=089e0160ce70d1ef1f04ddee0980 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369914346 news.xs4all.nl 15959 [2001:888:2000:d::a6]:51000 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46459 --089e0160ce70d1ef1f04ddee0980 Content-Type: text/plain; charset=ISO-8859-1 On 30 May 2013 12:42, "Eternaltheft" 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' --089e0160ce70d1ef1f04ddee0980 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On 30 May 2013 12:42, "Eternaltheft" <eternaltheft@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 inp= ut by the user, a default is returned

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

filename =3D raw_input('file name: ')
if not filename:
=A0=A0=A0 filename =3D 'your default'

--089e0160ce70d1ef1f04ddee0980--