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


Groups > comp.lang.python > #73629 > unrolled thread

Newbie coding question

Started byMartin S <shieldfire@gmail.com>
First post2014-06-26 20:53 +0200
Last post2014-06-26 21:16 +0200
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Newbie coding question Martin S <shieldfire@gmail.com> - 2014-06-26 20:53 +0200
    Re: Newbie coding question alister <alister.nospam.ware@ntlworld.com> - 2014-06-26 18:58 +0000
      Re: Newbie coding question Martin S <shieldfire@gmail.com> - 2014-06-26 21:16 +0200

#73629 — Newbie coding question

FromMartin S <shieldfire@gmail.com>
Date2014-06-26 20:53 +0200
SubjectNewbie coding question
Message-ID<mailman.11263.1403808853.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Hi,

I've been following the tutorial here
http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/
But when I get to section 1.10 there is

person = input('Enter your name: ')

However this generates an error


>>> person = input('Enter your name: ')
Enter your name: hi

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    person = input('Enter your name: ')
  File "<string>", line 1, in <module>
NameError: name 'hi' is not defined
>>>

I have no idea what I am doing wrong with this - it look correct to me.

I'm obviously doing something stupid, anyone can suggest what?

/M .
-- 
Regards,

Martin S

[toc] | [next] | [standalone]


#73631

Fromalister <alister.nospam.ware@ntlworld.com>
Date2014-06-26 18:58 +0000
Message-ID<g3_qv.159151$vj7.145337@fx27.am4>
In reply to#73629
On Thu, 26 Jun 2014 20:53:35 +0200, Martin S wrote:

> Hi,
> 
> I've been following the tutorial here
> http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/
> But when I get to section 1.10 there is
> 
> person = input('Enter your name: ')
> 
> However this generates an error
> 
> 
>>>> person = input('Enter your name: ')
> Enter your name: hi
> 
> Traceback (most recent call last):
>   File "<pyshell#0>", line 1, in <module>
>     person = input('Enter your name: ')
>   File "<string>", line 1, in <module>
> NameError: name 'hi' is not defined
>>>>
>>>>
> I have no idea what I am doing wrong with this - it look correct to me.
> 
> I'm obviously doing something stupid, anyone can suggest what?
> 
> /M .

As a quick guess you are using python 2.X when the tutorial is written 
for python 3.X
Input is one of the incompatible changes between 2.x & 3.x
try raw_input instead (or install Python 3)



-- 
You can't get there from here.

[toc] | [prev] | [next] | [standalone]


#73634

FromMartin S <shieldfire@gmail.com>
Date2014-06-26 21:16 +0200
Message-ID<mailman.11267.1403811513.18130.python-list@python.org>
In reply to#73631

[Multipart message — attachments visible in raw view] — view raw

Ah, that was actually correct.
Thanks ...

/Martin S


2014-06-26 20:58 GMT+02:00 alister <alister.nospam.ware@ntlworld.com>:

> On Thu, 26 Jun 2014 20:53:35 +0200, Martin S wrote:
>
> > Hi,
> >
> > I've been following the tutorial here
> > http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/
> > But when I get to section 1.10 there is
> >
> > person = input('Enter your name: ')
> >
> > However this generates an error
> >
> >
> >>>> person = input('Enter your name: ')
> > Enter your name: hi
> >
> > Traceback (most recent call last):
> >   File "<pyshell#0>", line 1, in <module>
> >     person = input('Enter your name: ')
> >   File "<string>", line 1, in <module>
> > NameError: name 'hi' is not defined
> >>>>
> >>>>
> > I have no idea what I am doing wrong with this - it look correct to me.
> >
> > I'm obviously doing something stupid, anyone can suggest what?
> >
> > /M .
>
> As a quick guess you are using python 2.X when the tutorial is written
> for python 3.X
> Input is one of the incompatible changes between 2.x & 3.x
> try raw_input instead (or install Python 3)
>
>
>
> --
> You can't get there from here.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards,

Martin S

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web