Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61723
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <amitsaha.in@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'string.': 0.05; 'string': 0.09; 'parsing': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'considers': 0.16; 'eof': 0.16; 'expects': 0.16; 'syntaxerror:': 0.16; 'unexpected': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'thanks.': 0.20; 'input': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '"",': 0.31; '13,': 0.31; '>>>>': 0.31; 'file': 0.32; '(most': 0.33; 'fri,': 0.33; 'received:google.com': 0.35; 'there': 0.35; 'recent': 0.39; 'provide': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'url:me': 0.69; 'behavior': 0.77; '2013,': 0.91; '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:from:date:message-id:subject:to :cc:content-type; bh=aw67Kj05QaZZslvwXGjpDEhBkxqBDDLXG4KKdte7OwI=; b=XQv1UrXrJgaumkkIzc0RREUXAwh9PEnmOs4XO9icpogNLFq8F0PV/jezYqKB++XaEf WYnmFOrVwMsCICxYEUNhOkx1preAPVIx1lFpy3TtDWPGRcIcw9ZzvL+yhrGF7XmS3Heb Qj8rEgc9FgH/SAyCpkXY0Q/CVAVw1gr4LBj1XIqS5y/wc8qbCpy7byRdutpGKf48T/rj JKEwFQnlSek9bXOuGy/lrNqfVgAYPJNkl2DRYkuVfkQ6L+HiME5yRFLYi2Qwsr11z8l2 gfMf3RQl7jNeL1p5itYEww/sa8FzaGL//Ir5gqtoJiFCS85ce8EBy7juguaaLAuEw39f dqwA== |
| X-Received | by 10.68.173.132 with SMTP id bk4mr2524614pbc.169.1386860209879; Thu, 12 Dec 2013 06:56:49 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <2ba69b81-99f9-40d6-a337-afb2f892ecff@googlegroups.com> |
| References | <2ba69b81-99f9-40d6-a337-afb2f892ecff@googlegroups.com> |
| From | Amit Saha <amitsaha.in@gmail.com> |
| Date | Fri, 13 Dec 2013 00:56:09 +1000 |
| Subject | Re: input() on python 2.7.5 vs 3.3.2 |
| To | stephen.boulet@gmail.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 <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.3997.1386860214.18130.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1386860217 news.xs4all.nl 2919 [2001:888:2000:d::a6]:47381 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61723 |
Show key headers only | View raw
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. -- http://echorand.me
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