All language subtitles for 16. Escape Sequences

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian Download
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Welcome back.

Let's talk about something called escape

sequence in Python let's comment this out and let me ask you a question.

What if we wanted to have a string that tells me let's say the weather.

And here we want to write it's sunny.

You see how the highlighting change here because I want to say it's with an apostrophe S..

But python is reading this and saying OK this is the start of the string and this is the end of the

string.

And then I have no idea what this is.

And then we're starting a string again.

How can we fix this.

Well we can add a double quote string instead.

And this now works.

But what if for some reason we also wanted to add it's kind of sunny in quotation marks.

Well now we have another issue.

So how can we solve this because in human language we have double quotes and apostrophes what we can

use escape sequences here and this is a little hard to understand at first but it's simply adding a

slash like this so the one right above your enter on the keyboard so this slash when Python goes through

it is going to say all right whatever comes after this I recognize this symbol whatever comes after

this I'm going to assume it's a string.

So now if I do backslash here and then backslash here it's going to say hey Python I'm letting you know

whatever comes after this is a string I'm letting you know whatever comes after this is a string and

then I'm letting you know what comes after this is a string so that when we print the weather everything

is printed nicely.

Awesome.

Now this escape sequence can be used in multiple ways.

For example if I want to have an actual backslash Well I can go like this.

And because it's saying whatever comes after this is a string it's going to assume that this is a string

now.

So if I run this you see that we get this backslash and there's a few other neat tricks a can do with

it.

For example one of it is the backslash T.

What does that mean.

Well let's remove this for now.

There you go the backslash t remember well it's out of space in here.

So we can distinguish it is going to say hey whatever comes after this.

I want you to add a tab.

This is a special meaning here.

So if I click on run you'll see that it's added a tab spacing to my string.

Another one is using n or a new line.

So let's leave t here and then add a backslash n and then say hope you have a good day.

What do you think will happen here.

Fact like run I have a tab from the backslash T.

And then I have a new line after kind of Sunny because I do the backslash and which denotes a new line

so that this shows up on a new line.

Now these escape sequences are hard to see at first but they're pretty much available in all programming

languages they use strings.

So if you come from another language this shouldn't be that strange to you.

If it's your first time seeing this you just need to get used to this syntax and every once in a while.

Go to the Python documentation and just type in escape sequences and you'll see all the ones that we

have.

These are the main ones that you need to know.

All right.

More to learn in the next video.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.