Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Why `len('‍️') == 4` and Other Weird Things You Should Know About Strings in Python

PyCon US via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
This PyCon US conference talk explores the unexpected behaviors of strings in Python, including puzzling phenomena like why `len('😶‍🌫️') == 4`, why 'ñ' doesn't equal 'ñ', and how 'dlrow olleh'.split()[1] equals 'olleh'. Dive into text encoding fundamentals and Unicode standards to understand how Python handles strings internally. Discover why a single code point can represent multiple characters, learn about locale-dependent case conversions, and explore the technical workings of emoji. Gain practical knowledge about common Unicode pitfalls and best practices for handling Unicode input in Python applications. After watching this 24-minute presentation, walk away with deeper insights into Python's string implementation, Unicode character encoding, and strategies to avoid text processing issues in your code.

Syllabus

Why `len('‍️') == 4` and other weird things you should know about strings in Python

Taught by

PyCon US

Reviews

Start your review of Why `len('‍️') == 4` and Other Weird Things You Should Know About Strings in Python

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.