Main Menu

friends

Banner

Latest articles

convert mysql table from MyISAM to InnoDB
30/12/2009 | mad mad mod

MyISAM is the default storage engine for MySQL. Unfortunately it doesn't support transactions or foreign keys (but it has some other nice features like compression). However, because InnoDB does su [ ... ]


XEN on fedora 8 - part 2: management basics
20/07/2009 | mad mad mod

This article describes how to manage a standard XEN environment on Fedora 8. It explains how to power on/off a virtual xen machine, how to open a console and some basics about performance monitoring.  [ ... ]


Other Articles

Designed by:
SiteGround web hosting Joomla Templates
Hello World in python E-mail
programming

This article describes how to write and execute a "Hello World" program in Python on Linux (Fedora).

 

1. the prerequisites

  • a text editor of your choice (e.g. vi)
  • a python interpreter


make sure you have installed the python rpm:

# rpm -qa python
python-2.5.1-26.fc8.2

 

If it is not installed yet, you can install it with yum (you need to be root to do that):

# yum install python

 

 

 

2. write the code


open an empty file with a text editor (e.g. vi):


# vi helloworld.py



now write the following code into the sourcefile:


#!/usr/bin/python
print "Hello World!";


save the file and exit vi with ":wq + enter"

 

explanation


#!/usr/bin/python

This tells the system to use the /usr/bin/python interpreter to execute the script. You can find out the full path of your python interpreter by entering the following command:


# which python
/usr/bin/python





print "Hello World!";

This prints out the string "Hello World!".

 

 

 

3. make the script executable



# chmod u+x helloworld.py




4. run the program


you can now execute the script program with:


# ./helloworld.py
Hello World!

 

- or -

 


# python helloworld.py

Hello World!

 

 

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

 
mad mad mod, Powered by Joomla! and designed by SiteGround web hosting