Python Wiki
Advertisement

General[]

The Hello World! is a small program and traditionally the first for newcomers.

Syntax[]

Interactive[]

If you like to typ it into the interactive environment, you have to start it with

python

and then you type in:

>>> print('Hello World!')

and you will get:

>>> print('Hello World!')
Hello World!

If you have Python 2.X, you type:

>>> print 'Hello World!'
Hello World!

In File[]

The classical 'Hello World!' is in Python 2.X just like this:

#!/usr/bin/env python

print 'Hello World!'

If you have Python 3.X, you must type in:

#!/usr/bin/env python

print('Hello World!')
Advertisement