The Python print() Function: Go Beyond the Basics
Christopher Trudeau
12 Lessons
57m
basics
python
If youβre like most Python users, including us, then you probably started your Python journey by learning about print(). It helped you write your very own Hello Horld one-liner. You can use it to display formatted messages onto the screen and perhaps find some bugs. But if you think thatβs all there is to know about Pythonβs print(), then youβre missing out on a lot!
Keep reading to take full advantage of this underappreciated little function. This course will get you up to speed with using Python print() effectively. Prepare for a deep dive as you go through the sections. You may be surprised how much print() has to offer!
By the end of this course, youβll know how to:
- Avoid common mistakes with Pythonβs
print() - Deal with newlines, character encodings, and buffering
- Write text to files
- Mock
print()in unit tests - Build advanced user interfaces in the terminal
Note: print() was a major addition to Python 3, in which it replaced the old print statement available in Python 2.
There were a number of good reasons for that, as youβll see shortly. Although this tutorial focuses on Python 3, it does show the old way of printing in Python for reference.
The Python print() Function: Go Beyond the Basics
12 Lessons 57m
2. String Formatting (03:42)
3. sep, end, and flush (07:23)
4. Printing to File Streams (02:43)
5. Custom Data Types (04:56)
7. Pretty Print (03:27)
8. ANSI Escape Sequences (01:57)
9. Animation (04:12)
11. Debugging (10:40)
12. Related Information (02:05)
About Christopher Trudeau
Christopher has a passion for the Python language and writes for Real Python. He is a consultant who helps advise organizations on how to improve their technical teams.
Β» More about Christopher



mbonilla on May 9, 2020
Thanks Christopher, great course.