Python 3, an Illustrated Tour Transcripts
Lecture: Unicode Literals
Login or purchase this course to watch this video and the rest of the course contents.
0:00 This video will discuss explicit unicode literals. These were created in Python 3.3 by pep for 414
0:09 and if you're using Python 2 and porting it to Python 3, these can be pretty important, just in review, all strings are unicode in Python 3 by default
0:19 that wasn't the case in Python 2, in Python 2 to make a unicode string or a unicode literal, you would put a u in front of your string.
0:27 So here's a little bit from the pep, the requirement to change the spelling of every unicode literal in an application
0:33 regardless of how it is accomplished is a key stumbling block for porting Python 2 to 3 efforts.
0:38 So this is simply an inclusion in Python 3 to ease the porting effort from Python 2 to 3. If you're only writing Python 3 code you can disregard this,
0:48 but if you're using Python 2 and want to write code that works in both or migrate, this can be something that can be useful.
0:55 Here's just some brief code. It shows that I can create a unicode string or a Python string
1:00 by putting u in front of it and I can do the same thing without a u in front of it. and those are equivalent.
1:09 Python 3 basically ignores the u and allows you to have it there for porting purposes.
1:14 So this is a brief section but useful for those who are migrating from Python 2 to 3.