🔥 BLACK FRIDAY SALE1 course ₹199·any 3 courses ₹399 for 3 months·ALL courses + 1 mock interview ₹599 for 6 monthsClaim offer →

Python · Python Foundations · Foundation · 26 min read

Python Strings, Unicode and Text Formatting: Encodings, f-strings, Format Specs and Safe Text Handling

Handle text correctly. Learn that str is a sequence of Unicode code points, bytes versus str and encodings, normalisation and case-folding, slicing and the everyday string methods, f-strings and the format mini-language, building strings efficiently, regular-expression basics, templates and escaping, and the classic bugs with encodings, whitespace and comparison.

Python Strings, Unicode and Text Formatting: Encodings, f-strings, Format Specs and Safe Text Handling: lesson illustration

A first look

  • Foundation level · 26 min read
  • 7 interview questions with model answers
  • Python Foundations · Python Mastery

You will learn to

  • What a Python string is: immutable Unicode, and why len may surprise you
  • str versus bytes, encodings, and where decoding bugs come from
  • The methods you use daily, and the ones people forget
  • …and 3 more topics inside
Create an account to start

Create a free account to see what this lesson covers

  • Every free lesson in every section, in full
  • Track your progress and pick up where you left off
  • Free practice questions and an incident simulation
  • Takes under a minute: name, email and a password

No card needed. Full access to Python is a paid upgrade you can choose later.