All language subtitles for 12. Importing Modules

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
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,180 --> 00:00:00,650 OK. 2 00:00:00,660 --> 00:00:02,540 We are moving into. 3 00:00:03,180 --> 00:00:05,810 I don't want to call it advanced python. 4 00:00:05,820 --> 00:00:09,510 I just want to say more advanced than where we were before. 5 00:00:09,600 --> 00:00:15,750 If previously we were in a one to one class or moving kind of into some one of two material I wouldn't 6 00:00:15,750 --> 00:00:17,670 even call it to a one material. 7 00:00:17,670 --> 00:00:20,970 This is just more advanced beginner stuff. 8 00:00:20,970 --> 00:00:21,630 How about that. 9 00:00:22,050 --> 00:00:26,180 So what we're gonna do is we're gonna go ahead and start a new script. 10 00:00:26,190 --> 00:00:32,850 That way we can kind of have our new one or two section here and kind of improve upon what we've been 11 00:00:32,850 --> 00:00:33,720 doing a little bit. 12 00:00:33,750 --> 00:00:40,290 So what I want you to do is I just want you to get it and we'll just call this new script that pie a 13 00:00:40,290 --> 00:00:49,620 little ampersand at the end as usual and we're just going to declare our bean bean Python three here. 14 00:00:49,710 --> 00:00:58,860 I can type it out bean Python 3 and we're going to go ahead and talk about our first concept which is 15 00:00:58,860 --> 00:01:04,670 going to be importing so importing is important. 16 00:01:04,710 --> 00:01:12,690 When we say importing modules are existent in Python writes in we have a lot of them built in but there 17 00:01:12,690 --> 00:01:16,730 are these modules that are not built in but available to us. 18 00:01:16,890 --> 00:01:25,770 For example a module called CIS now CIS does a lot of important things CIS has to deal with anything 19 00:01:25,770 --> 00:01:32,190 related to system functions and parameters one system function and parameter that we can do is something 20 00:01:32,190 --> 00:01:35,850 like printing out the version of Python that we're running. 21 00:01:35,850 --> 00:01:38,190 So you could say print this version. 22 00:01:38,620 --> 00:01:38,930 Okay. 23 00:01:38,940 --> 00:01:47,130 Now if we go to do that and we say save and we just go ahead and say Python 3 new script up high you 24 00:01:47,130 --> 00:01:51,900 could see the name of CIS is not defined so we're getting an error here. 25 00:01:51,900 --> 00:01:54,130 Well that's because we haven't imported it. 26 00:01:54,300 --> 00:02:03,420 So we can do is we can say import CIS and up here we can go ahead and just give this a nice comment 27 00:02:03,420 --> 00:02:11,660 next to it and we going to say that CIS is a system a function and parameters. 28 00:02:13,330 --> 00:02:19,380 OK and then let's go ahead and save this and now let's go and run it again. 29 00:02:19,380 --> 00:02:26,400 Now you can see that we are running Python three point seven point five RC one and we have now successfully 30 00:02:26,400 --> 00:02:27,890 printed this out. 31 00:02:27,960 --> 00:02:29,640 Why did this work this work. 32 00:02:29,640 --> 00:02:36,710 Because CIS does not by default come imported some items already built in by default. 33 00:02:36,990 --> 00:02:42,020 So this is not one of them but this is very important and we're going to use it over and over again. 34 00:02:42,030 --> 00:02:43,740 So you're gonna see it a lot. 35 00:02:43,740 --> 00:02:49,980 One of the most frequent if not the most frequent along with OS is another one import os you're going 36 00:02:49,980 --> 00:02:52,680 to see a lot of that over and over. 37 00:02:52,680 --> 00:02:54,990 So why are we going to see this. 38 00:02:54,990 --> 00:03:00,990 Well we have things like arguably so our v is arguments. 39 00:03:00,990 --> 00:03:06,960 So when you think about from the bash a lesson like dollar sign one when we had an argument and we were 40 00:03:06,960 --> 00:03:13,250 doing our ping like our script at S H and we had our IP address here as dollar sign one. 41 00:03:13,320 --> 00:03:14,790 Something along those lines. 42 00:03:14,850 --> 00:03:18,410 Well those are the same thing we just call it our v in Python. 43 00:03:18,570 --> 00:03:19,530 That's something. 44 00:03:19,560 --> 00:03:24,480 Another thing is if we want to say sis that exit which you're going to see again later in this course 45 00:03:24,960 --> 00:03:28,500 we do assist that exit that exits Python cleanly. 46 00:03:28,500 --> 00:03:30,040 We need a system exit. 47 00:03:30,120 --> 00:03:34,380 So you're going to see sis quite repeatedly on top of this. 48 00:03:34,440 --> 00:03:37,050 There's more things that we can do with modules. 49 00:03:37,050 --> 00:03:44,640 Let's go ahead and delete this and let's say that we wanted to import another module called Gate time. 50 00:03:44,640 --> 00:03:52,370 Now this does exactly what you think it does but what if we wanted to import a specific part of date 51 00:03:52,370 --> 00:03:53,960 time we didn't want to import the whole thing. 52 00:03:53,960 --> 00:03:55,460 We just want to import one module. 53 00:03:55,490 --> 00:04:03,230 We can say from the date time import date time so we can do the same thing with CIS we can import a 54 00:04:03,230 --> 00:04:06,640 specific part of this or we can import all of this. 55 00:04:06,650 --> 00:04:10,750 So at day time we're importing a specific part of it. 56 00:04:10,760 --> 00:04:11,560 Right. 57 00:04:11,630 --> 00:04:20,240 And we can do something like print date time dot now something like that and it should print us the 58 00:04:20,300 --> 00:04:21,540 date time. 59 00:04:21,560 --> 00:04:23,400 So do this. 60 00:04:23,750 --> 00:04:27,260 You can see now today's date is 11 16 20 19. 61 00:04:27,270 --> 00:04:36,080 And what time we're recording so we can also do another nifty feature when it comes to importing we 62 00:04:36,080 --> 00:04:45,650 can import with aliases so instead of from date time import date time we can say import date time as 63 00:04:46,940 --> 00:04:48,440 something like D.T.. 64 00:04:48,450 --> 00:04:55,910 You could say import with alias and instead of having to write date time that now over and over and 65 00:04:55,910 --> 00:04:59,680 over something like that we can just write D.T. is shorter. 66 00:04:59,690 --> 00:05:03,930 We know what it means and we know how to write out date time which is kind of lengthy. 67 00:05:04,040 --> 00:05:07,850 So credit again you can see it still works. 68 00:05:07,910 --> 00:05:10,910 So importing is important. 69 00:05:10,940 --> 00:05:12,410 I'm going to say it again. 70 00:05:12,710 --> 00:05:18,360 You need to know that we're going to be importing certain modules out of Python. 71 00:05:18,380 --> 00:05:22,430 Most of these are built in their occasional times you're going to have to go out and download something 72 00:05:22,430 --> 00:05:24,910 and put it in your library and import it that way. 73 00:05:24,970 --> 00:05:30,350 But for this course that we're doing you're only going to be importing from things that are pre existing 74 00:05:30,560 --> 00:05:31,690 with Python. 75 00:05:31,790 --> 00:05:34,870 So not everything is automatically ready to go. 76 00:05:34,880 --> 00:05:40,700 Sometimes you have to import things in order to improve upon your script or do make it do what you want 77 00:05:40,700 --> 00:05:41,610 to do. 78 00:05:41,630 --> 00:05:46,930 So we're going to build off of this when we start writing our scripts and you're going to see this repeatedly. 79 00:05:46,940 --> 00:05:51,830 You're going to also see this again when we do our exploit development part of the course. 80 00:05:51,860 --> 00:05:53,660 So let's go ahead and move on. 81 00:05:53,690 --> 00:05:57,680 We're going to move on to some advance strings and we're going to get close to wrapping up here and 82 00:05:57,680 --> 00:06:00,100 start building out some cool little python scripts. 83 00:06:00,140 --> 00:06:01,360 So I'll see you over in the next video. 8315

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