Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61727
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'string.': 0.05; 'string': 0.09; 'lawrence': 0.09; 'parsing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language.': 0.14; 'considers': 0.16; 'eof': 0.16; 'expects': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'syntaxerror:': 0.16; 'unexpected': 0.16; 'subject:python': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'thanks.': 0.20; 'input': 0.22; 'header:User-Agent:1': 0.23; '2.x': 0.24; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'dec': 0.30; 'skip:( 20': 0.30; '"",': 0.31; '13,': 0.31; 'file': 0.32; '(most': 0.33; 'fri,': 0.33; '"the': 0.34; 'there': 0.35; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'dangerous': 0.60; 'our': 0.64; 'provide': 0.64; 'more': 0.64; 'behavior': 0.77; 'amit': 0.84; '2013,': 0.91; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: input() on python 2.7.5 vs 3.3.2 |
| Date | Thu, 12 Dec 2013 15:04:39 +0000 |
| References | <2ba69b81-99f9-40d6-a337-afb2f892ecff@googlegroups.com> <CANODV3mj84V9K8Tyvj65pYzbuuKvxOOfAoyQhNAGH9E84kPQ0g@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-78-147-191-126.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <CANODV3mj84V9K8Tyvj65pYzbuuKvxOOfAoyQhNAGH9E84kPQ0g@mail.gmail.com> |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4000.1386861007.18130.python-list@python.org> (permalink) |
| Lines | 43 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386861007 news.xs4all.nl 2847 [2001:888:2000:d::a6]:57977 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61727 |
Show key headers only | View raw
On 12/12/2013 14:56, Amit Saha wrote: > On Fri, Dec 13, 2013 at 12:45 AM, <stephen.boulet@gmail.com> wrote: >> Can someone explain? Thanks. >> >> Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> x = input() >> Hello there >>>>> print(x) >> Hello there > > In Python 3, input() considers an input as a string and returns the > input as a string. This is the behavior of raw_input() in Python 2. > >> >> Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> x = input() >> Hello there >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File "<string>", line 1 >> Hello there >> ^ >> SyntaxError: unexpected EOF while parsing > > In Python 2, input() expects valid Python as it's input. If you > provide your input as 'Hello there' (a Python string), it won't > complain. > > HTH, > Amit. > I much prefer Chris Angelico's response "The input() function in Python 2.x is a very dangerous one - it's equivalent to eval(input()) in Python 3." -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
input() on python 2.7.5 vs 3.3.2 stephen.boulet@gmail.com - 2013-12-12 06:45 -0800 Re: input() on python 2.7.5 vs 3.3.2 Chris Angelico <rosuav@gmail.com> - 2013-12-13 01:53 +1100 Re: input() on python 2.7.5 vs 3.3.2 Amit Saha <amitsaha.in@gmail.com> - 2013-12-13 00:56 +1000 Re: input() on python 2.7.5 vs 3.3.2 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-12 15:04 +0000 Re: input() on python 2.7.5 vs 3.3.2 Chris Angelico <rosuav@gmail.com> - 2013-12-13 02:17 +1100
csiph-web