Printing in Python

Posted on Thu 19 November 2015 in Python

python

Printing the statement

Its easy task to print a statement in python. Here Iam gonna print "Hello all, Welcome to my blog". Lets see how to print it.

print("Hello all, Welcome to my blog")

Above is the example for printing the statement in python where print is a keyword.

Printing Multiple lines

To print multiple lines,

print """ Hello There
Iam happy to welcome you all
for my blog"""

The above code will print the statement as you entered within the triple cotes.

To run it as file

Open a new python file using any text editor, say for example gedit by using the following command line gedit filename.py

and then type the above code and save. Then run the file using the command, python filename.py