fir3net
PPS-Firenetbanner-780.5x190-30-03-17

Python - Print Examples

Below is a small example to show some of the various way in which print can be called within Python.

quote = "A person who never made a mistake never tried anything new."

print("ORIGINAL")
print(quote)


print("\nUPPERCASE")
print(quote.upper())

print("\nLOWERCASE")
print(quote.lower())

print("\nTITLE")
print(quote.title())

print("\nREPLACE")
print(quote.replace("person", "banana"))

Output

[root@linux]# python print_example.py
ORIGINAL
A person who never made a mistake never tried anything new.

UPPERCASE
A PERSON WHO NEVER MADE A MISTAKE NEVER TRIED ANYTHING NEW.

LOWERCASE
a person who never made a mistake never tried anything new.

TITLE
A Person Who Never Made A Mistake Never Tried Anything New.

REPLACE
A banana who never made a mistake never tried anything new.
[root@Fileserver python]# python string_manip.py

Tags: Python

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001