Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46462

Re: User Input

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 <rosuav@gmail.com>
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 <e3fd9fdd-efa0-45b8-97b9-b77519012640@googlegroups.com> <7f9b7a2e-3142-468b-a2ce-9434c1ad7989@googlegroups.com>
Date Thu, 30 May 2013 22:06:41 +1000
Subject Re: User Input
From Chris Angelico <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2407.1369915604.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Thu, May 30, 2013 at 9:48 PM, Eternaltheft <eternaltheft@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 04:33 -0700
  Re: User Input Fábio Santos <fabiosantosart@gmail.com> - 2013-05-30 12:45 +0100
  Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 04:48 -0700
    Re: User Input Chris Angelico <rosuav@gmail.com> - 2013-05-30 22:06 +1000
    Re: User Input MRAB <python@mrabarnett.plus.com> - 2013-05-30 13:08 +0100
    Re: User Input Fábio Santos <fabiosantosart@gmail.com> - 2013-05-30 13:10 +0100
  Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 05:19 -0700
    Re: User Input Fábio Santos <fabiosantosart@gmail.com> - 2013-05-30 13:27 +0100
    Re: User Input Chris Angelico <rosuav@gmail.com> - 2013-05-30 22:28 +1000
  Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 05:37 -0700
    Re: User Input Dave Angel <davea@davea.name> - 2013-05-30 08:58 -0400
    Re: User Input Chris Angelico <rosuav@gmail.com> - 2013-05-30 22:59 +1000
  Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 06:10 -0700
    Re: User Input Dave Angel <davea@davea.name> - 2013-05-30 09:37 -0400
      Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 07:03 -0700
        Re: User Input Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-30 15:30 +0100
          Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 07:49 -0700
      Re: User Input Eternaltheft <eternaltheft@gmail.com> - 2013-05-30 07:47 -0700
        Re: User Input Joshua Landau <joshua.landau.ws@gmail.com> - 2013-05-30 16:09 +0100

csiph-web