LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2006, 11:48 AM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Rep: Reputation: 47
Print




I am trying to learn Python. I have never ever studied Python. I am running Mandriva Linux 2006 version. It is a 64 bit program.



[nissanka@c83-250-110-112 ~]$ python
Python 2.4.1 (#2, Aug 29 2005, 20:13:14)
[GCC 4.0.1 (4.0.1-4mdk for Mandriva Linux release 2006.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> the_world_is_flat = 1
>>> if the_world_is_flat:
... print "Be careful not to fall off!"
File "<stdin>", line 2
print "Be careful not to fall off!"
^
IndentationError: expected an indented block
>>> print "Be careful not to fall off!"

[ What is the problem with print? It says about an indentation error. What is it? How do I rectify it?]

Your help is appreciated.
 
Old 08-04-2006, 11:56 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
The problem is that your print line is not indented properly, hence you get that error. If you press your tab key and then write "print "Be careful...", it'll be OK. See this for info about how Python uses whitespace and indentation. Edit: if you use the Python IDE called IDLE, the indentation is done automatically.

Last edited by Nylex; 08-04-2006 at 11:57 AM.
 
Old 08-04-2006, 12:25 PM   #3
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
Thanks Nylex for the comment.

Today is the firs day in my life, I looked at the Python. I know the existence of it. But never ever thought of learning it.

Yesterday a friend of mine persuaded me to learn some Python.


Yes, pressing the tab key worked fine. I hope you know Python very well.

Last edited by Gins; 08-04-2006 at 12:28 PM.
 
Old 08-04-2006, 12:26 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
No problem. I've only just started learning Python myself .
 
Old 08-04-2006, 12:34 PM   #5
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
You mentioned an IDE called IDLE. How do I get it?

On my system, Python is built in.

My friend suggested writing 'Python' on the shell to see whether it is there. It is there by default.

How do I get hold of this IDLE?
 
Old 08-04-2006, 01:03 PM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
IDLE comes with Python, simply run "idle" in a terminal.
 
Old 08-04-2006, 01:07 PM   #7
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47

You are great, Nylex.

It is there.


I will start using it now.
 
Old 08-04-2006, 01:58 PM   #8
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
You may want to subscribe to the python-tutor mailing list. There are many teachers, authors, developers etc who subscribe to that list and can help you with any newbie type problems.
 
Old 08-04-2006, 03:19 PM   #9
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47

Thanks Reddazz. Now I registered there too.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
EPSON Stylus Photo R200 - CUPS+Gimp-Print v4.2.7 does not print anymore Harp00 Linux - Newbie 1 05-24-2006 10:59 AM
Print-to-file print driver to print PDF Bill Fox Linux - General 3 05-02-2006 04:15 PM
Print jobs repeat infinetly on lpd printer attached to axis print server linux-who? Linux - Hardware 0 03-28-2006 11:24 AM
HP PS7150: text doesn't print in OOO and Abiword!, but I can print test page & w MzFF gabba Mandriva 6 10-31-2005 11:10 AM
Mozilla problems: Print/print preview doesn't work, not recording sites in history... andy_g_gray Linux - Software 3 01-23-2004 06:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration