All language subtitles for 12. Importing Modules

af Afrikaans
ak Akan
sq Albanian
am Amharic
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

Original subtitles

OK.

We are moving into.

I don't want to call it advanced python.

I just want to say more advanced than where we were before.

If previously we were in a one to one class or moving kind of into some one of two material I wouldn't

even call it to a one material.

This is just more advanced beginner stuff.

How about that.

So what we're gonna do is we're gonna go ahead and start a new script.

That way we can kind of have our new one or two section here and kind of improve upon what we've been

doing a little bit.

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

little ampersand at the end as usual and we're just going to declare our bean bean Python three here.

I can type it out bean Python 3 and we're going to go ahead and talk about our first concept which is

going to be importing so importing is important.

When we say importing modules are existent in Python writes in we have a lot of them built in but there

are these modules that are not built in but available to us.

For example a module called CIS now CIS does a lot of important things CIS has to deal with anything

related to system functions and parameters one system function and parameter that we can do is something

like printing out the version of Python that we're running.

So you could say print this version.

Okay.

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

could see the name of CIS is not defined so we're getting an error here.

Well that's because we haven't imported it.

So we can do is we can say import CIS and up here we can go ahead and just give this a nice comment

next to it and we going to say that CIS is a system a function and parameters.

OK and then let's go ahead and save this and now let's go and run it again.

Now you can see that we are running Python three point seven point five RC one and we have now successfully

printed this out.

Why did this work this work.

Because CIS does not by default come imported some items already built in by default.

So this is not one of them but this is very important and we're going to use it over and over again.

So you're gonna see it a lot.

One of the most frequent if not the most frequent along with OS is another one import os you're going

to see a lot of that over and over.

So why are we going to see this.

Well we have things like arguably so our v is arguments.

So when you think about from the bash a lesson like dollar sign one when we had an argument and we were

doing our ping like our script at S H and we had our IP address here as dollar sign one.

Something along those lines.

Well those are the same thing we just call it our v in Python.

That's something.

Another thing is if we want to say sis that exit which you're going to see again later in this course

we do assist that exit that exits Python cleanly.

We need a system exit.

So you're going to see sis quite repeatedly on top of this.

There's more things that we can do with modules.

Let's go ahead and delete this and let's say that we wanted to import another module called Gate time.

Now this does exactly what you think it does but what if we wanted to import a specific part of date

time we didn't want to import the whole thing.

We just want to import one module.

We can say from the date time import date time so we can do the same thing with CIS we can import a

specific part of this or we can import all of this.

So at day time we're importing a specific part of it.

Right.

And we can do something like print date time dot now something like that and it should print us the

date time.

So do this.

You can see now today's date is 11 16 20 19.

And what time we're recording so we can also do another nifty feature when it comes to importing we

can import with aliases so instead of from date time import date time we can say import date time as

something like D.T..

You could say import with alias and instead of having to write date time that now over and over and

over something like that we can just write D.T. is shorter.

We know what it means and we know how to write out date time which is kind of lengthy.

So credit again you can see it still works.

So importing is important.

I'm going to say it again.

You need to know that we're going to be importing certain modules out of Python.

Most of these are built in their occasional times you're going to have to go out and download something

and put it in your library and import it that way.

But for this course that we're doing you're only going to be importing from things that are pre existing

with Python.

So not everything is automatically ready to go.

Sometimes you have to import things in order to improve upon your script or do make it do what you want

to do.

So we're going to build off of this when we start writing our scripts and you're going to see this repeatedly.

You're going to also see this again when we do our exploit development part of the course.

So let's go ahead and move on.

We're going to move on to some advance strings and we're going to get close to wrapping up here and

start building out some cool little python scripts.

So I'll see you over in the next video.

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