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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,630 --> 00:00:01,760 Welcome back. 2 00:00:01,770 --> 00:00:04,440 Let's talk about something called escape 3 00:00:06,820 --> 00:00:15,530 sequence in Python let's comment this out and let me ask you a question. 4 00:00:15,670 --> 00:00:20,220 What if we wanted to have a string that tells me let's say the weather. 5 00:00:21,130 --> 00:00:29,770 And here we want to write it's sunny. 6 00:00:30,070 --> 00:00:36,970 You see how the highlighting change here because I want to say it's with an apostrophe S.. 7 00:00:37,150 --> 00:00:43,400 But python is reading this and saying OK this is the start of the string and this is the end of the 8 00:00:43,400 --> 00:00:43,910 string. 9 00:00:44,060 --> 00:00:45,620 And then I have no idea what this is. 10 00:00:45,620 --> 00:00:48,470 And then we're starting a string again. 11 00:00:48,610 --> 00:00:51,020 How can we fix this. 12 00:00:51,040 --> 00:00:55,340 Well we can add a double quote string instead. 13 00:00:55,570 --> 00:00:58,240 And this now works. 14 00:00:58,240 --> 00:01:07,670 But what if for some reason we also wanted to add it's kind of sunny in quotation marks. 15 00:01:07,670 --> 00:01:10,480 Well now we have another issue. 16 00:01:10,670 --> 00:01:19,580 So how can we solve this because in human language we have double quotes and apostrophes what we can 17 00:01:19,580 --> 00:01:28,430 use escape sequences here and this is a little hard to understand at first but it's simply adding a 18 00:01:28,550 --> 00:01:39,170 slash like this so the one right above your enter on the keyboard so this slash when Python goes through 19 00:01:39,170 --> 00:01:45,110 it is going to say all right whatever comes after this I recognize this symbol whatever comes after 20 00:01:45,110 --> 00:01:49,420 this I'm going to assume it's a string. 21 00:01:49,430 --> 00:01:59,680 So now if I do backslash here and then backslash here it's going to say hey Python I'm letting you know 22 00:01:59,680 --> 00:02:04,300 whatever comes after this is a string I'm letting you know whatever comes after this is a string and 23 00:02:04,300 --> 00:02:14,010 then I'm letting you know what comes after this is a string so that when we print the weather everything 24 00:02:14,040 --> 00:02:16,260 is printed nicely. 25 00:02:16,410 --> 00:02:18,070 Awesome. 26 00:02:18,080 --> 00:02:23,240 Now this escape sequence can be used in multiple ways. 27 00:02:23,270 --> 00:02:29,990 For example if I want to have an actual backslash Well I can go like this. 28 00:02:29,990 --> 00:02:35,360 And because it's saying whatever comes after this is a string it's going to assume that this is a string 29 00:02:35,360 --> 00:02:35,730 now. 30 00:02:35,750 --> 00:02:42,680 So if I run this you see that we get this backslash and there's a few other neat tricks a can do with 31 00:02:42,680 --> 00:02:43,320 it. 32 00:02:43,370 --> 00:02:50,630 For example one of it is the backslash T. 33 00:02:50,730 --> 00:02:51,900 What does that mean. 34 00:02:51,900 --> 00:02:54,530 Well let's remove this for now. 35 00:02:54,540 --> 00:03:00,130 There you go the backslash t remember well it's out of space in here. 36 00:03:00,140 --> 00:03:04,770 So we can distinguish it is going to say hey whatever comes after this. 37 00:03:04,940 --> 00:03:06,800 I want you to add a tab. 38 00:03:06,800 --> 00:03:08,960 This is a special meaning here. 39 00:03:08,960 --> 00:03:17,010 So if I click on run you'll see that it's added a tab spacing to my string. 40 00:03:17,030 --> 00:03:22,220 Another one is using n or a new line. 41 00:03:22,220 --> 00:03:32,040 So let's leave t here and then add a backslash n and then say hope you have a good day. 42 00:03:34,200 --> 00:03:35,770 What do you think will happen here. 43 00:03:35,790 --> 00:03:42,940 Fact like run I have a tab from the backslash T. 44 00:03:43,310 --> 00:03:50,190 And then I have a new line after kind of Sunny because I do the backslash and which denotes a new line 45 00:03:50,660 --> 00:03:54,190 so that this shows up on a new line. 46 00:03:54,200 --> 00:04:00,290 Now these escape sequences are hard to see at first but they're pretty much available in all programming 47 00:04:00,290 --> 00:04:01,910 languages they use strings. 48 00:04:01,910 --> 00:04:05,960 So if you come from another language this shouldn't be that strange to you. 49 00:04:06,080 --> 00:04:12,020 If it's your first time seeing this you just need to get used to this syntax and every once in a while. 50 00:04:12,110 --> 00:04:17,660 Go to the Python documentation and just type in escape sequences and you'll see all the ones that we 51 00:04:17,660 --> 00:04:18,100 have. 52 00:04:18,110 --> 00:04:21,380 These are the main ones that you need to know. 53 00:04:21,390 --> 00:04:21,900 All right. 54 00:04:21,900 --> 00:04:23,370 More to learn in the next video. 5127

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