Python: f Strings are Magical
f strings or formatted strings allow you to embed expression within string literals. The expressions must be placed inside the curly braces. f strings are very powerful tool and they have made how so easy to format the output. These were introduced in Python 3.6
With f strings, you can replace a variable, do calculations, format (left, right or center align) among many other tasks.
Timeline:
00:00 Intro
00:20 Agenda
00:38 Replacing Variables
02:57 Calculations/formatting integers and floats
04:40 Format Specifiers, left, right & center alignment
05:59 Padding
06:22 Thousand Separator
07:46 Formatting Date
10:34 Formatting Time
11:07 Time in 12 Hour Format with AM/PM
11:44 Number Conversion from Decimal to Binary, Octal & Hexa
12:50 Conversion of Binary Number to Decimal
13:32 Printing Curly Braces
14:02 Outro
Python Official Doc: docs.python.org/3/library/string.html#formatspec
Twitter: x.com/4EverPrem
GitHub: github.com/Prem-gzb/Python/blob/main/F%20Strings/f…
Python Basics Playlist: • Python Basics
Python Operators Playlist: • Python Operators
#SimpleEasyPython #Python
コメント