Learning Python

Hi guys

I’ve decided I’m gonna try and teach myself a little Python and I’m stuck on the first lesson, the script below was copied and pasted from this site http://blog.pluralsight.com/introduction-to-python-programming-in-ubuntu-linux

according to the author this very simple script should run, but when I try to run it I get this error

“There’s an error in your program EOL while scanning string literal”

Here’s the script

#Have user input version and print response
name = raw_input("What Linux release do you use?”)
print “I also like”, name, ” – Linux rules!”

Any ideas ?


Dunno why you got that, but copy/pasting yours didn’t work … the guy had inserted non ASCII characters, because he want YOU to type in the text.

This should work

#Have user input version and print response
name = raw_input("Which Linux release do you use ? ")
print "I also like", name, "- Linux rules!"

Bung that in a file called linuxversion.py … place it in your home folder, and run:

python linuxversion.py

ALWAYS type it up yourself, rather than copy/paste :wink:

Mark said it all really.
Just tried it in Idle and it worked fine but I did type it.

You’re using idle right ? … not idle3

The syntax differs slightly for python3

Which would be something along the lines of:

#!/usr/bin/env python3
#Have user input version and print response
name = input("Which Linux release do you use ? ")
print ("I also like", name, "- Linux rules!")

Thanks guys

Yeah typing the code in manually sorted it and it works fine

You're using idle right ? .. not idle3

I have 2 entries for IDLE in my menu…IDLE & IDLE (using python-2.7), I’ve just been using IDLE

Can anyone suggest any online Python tutorials for the completely clueless

The only programming experience I have is many years ago I wrote some very simple programs in BASIC using a ZX Spectrum and I enjoyed doing it but that was a very simple language to understand, I wrote a game for my daughter to play (Who was around 5 or 6 at the time) and I want to see if i can recreate it in Python

Anyway thanks for your help


Python is the closest language to BASIC without any doubt, it can be as simple or as complex as your want it to be!
You need to be aware that Python 2 & Python 3 are quite different, and are NOT compatible. My advice would be to forget Python 2, and focus on Python 3 as that is the future.

You could try this out - Beginning Python - Free download, Code examples, Book reviews, Online preview, PDF
I haven’t read it myself, but the blurb sounds good

Hi Chemicalfan

Thanks for your advice and the link, I’ll check it out later when I get home, I’m currently following a tutorial from a book titled “Python For The Absolute Beginner” and already I’ve managed to write this amazing program that prints “Hello World” on the screen,

Yeah it is a lot like BASIC as I remember so I’ll keep plugging away, it can be frustrating when you run a module and get a syntax error and can’t figure out what it is, but I suppose if it was easy it wouldn’t be worth doing

a programming section on this site would be helpful but there probably wouldn’t be enough people programming to justify it

Many thanks


Erm … there is one (in the TechZone):

Doesn’t get much traffic though

The forum above is excellent, the guys there have amazing knowledge.
You do have to follow their rules about “getting them to do your homework”

Thanks for that Mark

Sorry I never knew that section existed, you’re right about the traffic last post was about 3 months ago, but if I keep up this Python thing I’m sure I could keep it busy :slight_smile:

Many thanks