LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-03-2006, 01:57 AM   #1
Mikesoft
Member
 
Registered: Jun 2005
Location: England, Cheam
Distribution: Fedora Core 6
Posts: 96

Rep: Reputation: 15
Need Help with python 2.3


I have started to learn python. However I am very confused how to use the python 2.3 application. When I open the app I get a konsole window which allows me to type in python code and then it immidately gets 'converted' to real world language. However how would I enter long scripts into this console window which go below one line? Everytime I try going below one line by pressing enter the app converts my first line of code.

Also, how can I read a .py file?

Thanks

Mike
 
Old 03-03-2006, 03:07 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Use a text editor like KATE, EMACS or VIM to read and write *.py files (You can also use IDLE pythons built in IDE). You can then execute the *.py files from the command line by doing something like "python myfile.py". I find it better to write python programs as seperate scripts than entering long programs in the command line intepreter, but if you can use \ at the end of your lines, if you need to enter code on more than one line.
 
Old 03-03-2006, 03:08 AM   #3
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
That's easy Just create your python program in a separate file, using any text editor. Don't forget to get the indentation right. e.g.
Code:
for i in range(10):
    print 'Hello'
If you save this in a file called hello.py then you can run it from the command line with

$ python hello.py

There's lots more twists and turns, but that will get you started. To read a *.py file just open it in a text editor.

Last edited by maroonbaboon; 03-03-2006 at 03:11 AM.
 
Old 03-04-2006, 01:45 AM   #4
Mikesoft
Member
 
Registered: Jun 2005
Location: England, Cheam
Distribution: Fedora Core 6
Posts: 96

Original Poster
Rep: Reputation: 15
Thanks. My knowlage has once again increased with geeky stuff!

One more (maybe silly) question. How can the python programming language be used? eg. Games, Programs?
 
Old 03-04-2006, 02:00 AM   #5
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
Originally Posted by Mikesoft
Thanks. My knowlage has once again increased with geeky stuff!

One more (maybe silly) question. How can the python programming language be used? eg. Games, Programs?
It can be used for a lot of stuff including games, utilities and web development. Many Redhat and Ubuntu config tools are written in python. Its best to take a look at the info on the python website because it will answer many of your questions.
 
Old 03-04-2006, 06:34 AM   #6
Mikesoft
Member
 
Registered: Jun 2005
Location: England, Cheam
Distribution: Fedora Core 6
Posts: 96

Original Poster
Rep: Reputation: 15
Thanks again!
 
Old 03-04-2006, 06:46 AM   #7
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,337

Rep: Reputation: 65
If you want to use python to write games, check this link out:

www.pygame.org

it's a wrap for sdl library and works great
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Processing Conflict: python-devel conflicts python< 2.3.4-13.1 guarriman Fedora 2 04-23-2009 07:02 PM
python problem - compiled from source - python -V still showing old version txm123 Linux - Newbie 1 02-15-2006 11:05 AM
installing python library's (Python Numeric) Four Linux - Newbie 1 10-16-2005 02:31 PM
WineX, python-gnome, and python-gtk DrD Fedora 0 08-03-2004 12:11 PM
install python 2.3 ,necssary to remove python 2.2 ngan_yine Linux - Newbie 7 12-28-2003 04:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:07 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