Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.071 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'compact': 0.09; 'filename': 0.09; 'input,': 0.09; 'python': 0.11; 'evaluates': 0.16; 'fabio': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'notation': 0.16; 'renamed': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'entered': 0.20; 'input': 0.22; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; 'text': 0.33; 'raw': 0.33; 'trouble': 0.34; 'no,': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'hi,': 0.36; 'example,': 0.37; 'ahead': 0.38; 'conditions.': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'dangerous': 0.60; 'name:': 0.61; 'name': 0.63; 'such': 0.63; '30,': 0.65; 'prompt': 0.68; 'default': 0.69; 'user,': 0.69; 'safe': 0.72; 'one;': 0.84; 'reply!': 0.84; '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 :content-type; bh=DVTx13b/5cqz1Iwqdconv5CTZ1YrvXKYHcG+mt2rBkY=; b=pBShLSE5OQp//90YhvkCBvYvEqrLzzbK9vJDLKv3SKYDdiNpywO04CeYusUI+/o6JG tRH+hsrFFVgdZmi49T+ryouOoNW+xaQIIDAGxI5/O4iUMv7zFcdymuw/LEwX2C2encLx fEXFkVcNnpMjrVFPlhaOJVXAdJ9DSoO3lD5u9KcuqAxvVh3YYS4Q0AxVhJ7I+J0ncZJD rCBVwMlRKB+DnesS0g5HyrBNHNmp9GXRfUSrPqxutJgreU+6Hgm1QNyhKNykT77xCc+N kYbEqRDilB5kW4JDReQm4SxewHJ73VY3CMvBSPfdbsUWwWCY3QasmMWM8kkx02aNVTMg pi5Q== MIME-Version: 1.0 X-Received: by 10.52.164.163 with SMTP id yr3mr4323509vdb.76.1369915601552; Thu, 30 May 2013 05:06:41 -0700 (PDT) In-Reply-To: <7f9b7a2e-3142-468b-a2ce-9434c1ad7989@googlegroups.com> References: <7f9b7a2e-3142-468b-a2ce-9434c1ad7989@googlegroups.com> Date: Thu, 30 May 2013 22:06:41 +1000 Subject: Re: User Input From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369915604 news.xs4all.nl 15961 [2001:888:2000:d::a6]:33825 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46462 On Thu, May 30, 2013 at 9:48 PM, Eternaltheft wrote: > On Thursday, May 30, 2013 7:33:41 PM UTC+8, 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 > > Thanks for such a fast reply! and no im not using raw input, im just using input. does raw_input work on python 3? No, on Python 3 just use input. In Python 2, input() is a dangerous function that evaluates the entered text and raw_input() is the safe one; in Python 3, raw_input got renamed to input(). Go ahead and use input the way Fabio used raw_input. By the way, there's a handy compact notation for what Fabio wrote: filename = raw_input('file name: ') or 'your default' Can be very handy! ChrisA