Hello World In Python Tutorial

by on March 18, 2008 · 4 comments· LAST UPDATED November 15, 2012

in , ,

How do I write my first program in python? How do I print "hello world" message in Python?

Tutorial details
DifficultyEasy (rss)
Root privilegesNo
Estimated completion timeN/A

Python is easy to use, general-purpose high-level programming language. ython is often used as a scripting language and for writing tasks such as:

=> Sys admin programming

=> Web projects

=> GUI projects etc

Task: Write "Hello world" program in python

Use a text editor such as vi, gedit or any other text editor. Create a program file called hello.py:
$ vi hello.py
Now type the following program:

# My first python program
print "Hello, World!\n"

Save and close the file. Type the following command to set permission:
$ chmod +x hello.py
To run a program, enter:
$ ./hello.py

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 4 comments… read them below or add one }

1 Philippe Petrinko March 31, 2010 at 12:55 pm

Yeah, right, but it misses your usual and useful “Further Readings” chapter… ;-)


2 punktyras February 28, 2013 at 3:55 pm

language. ython is often


3 Hammad Khan March 26, 2013 at 7:00 am

You can also execute your scripts with this command line.

python yourpythonfile.py


4 Matt T. April 27, 2014 at 1:54 am

You need to update this. Python 2.xx uses print ” “, while python 3.xx uses print(” “)


Leave a Comment

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: