PDA

View Full Version : Python help needed



arnab_das
February 13th, 2010, 07:34 PM
Hi!

am learning to use python.

i am using the default gedit text editor (is that okay?)



#!/usr/bin/env python
1 name = input('What is your name?\n')
2 print 'Hi, ' + name + '.'

this is the script i typed. i saved it as hello.py
now i typed chmod u+x hello.py
next i typed ./hello.py

however the output i get is:


File "./hello.py", line 2
1 name = input('What is your name?\n')
^
SyntaxError: invalid syntax

what am i doing wrong? plz help.

Zugzwang
February 13th, 2010, 07:35 PM
Remove the leading "1" from line 2 and "2" from line 3. Line numbers like in Basic are not allowed in Python.

arnab_das
February 13th, 2010, 07:39 PM
that was freakin awesome! thank u.