Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46462
| References | <e3fd9fdd-efa0-45b8-97b9-b77519012640@googlegroups.com> <7f9b7a2e-3142-468b-a2ce-9434c1ad7989@googlegroups.com> |
|---|---|
| Date | 2013-05-30 22:06 +1000 |
| Subject | Re: User Input |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2407.1369915604.3114.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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