Python if __name__ == '__main__' ❓

  Рет қаралды 37,719

Bro Code

Bro Code

Күн бұрын

Пікірлер: 48
@fireemblem2770
@fireemblem2770 3 жыл бұрын
At 2:47 onward, I began to actually grasp what this concept might mean. All other videos I watched did not help until I found this one. I owe you the career I make later in life!!
@aykira7
@aykira7 3 жыл бұрын
same
@BroCodez
@BroCodez 4 жыл бұрын
# *********************************** # if __name__ == '__main__' # *********************************** # y tho? # 1. Module can be run as a standalone program # 2. Module can be imported and used by other modules # Python interpreter sets "special variables", one of which is __name__ # Python will assign the __name__ variable a value of '__main__' if it's # the initial module being run def main(): print("Hello!") if __name__ == '__main__': main() # ***********************************
@jag7450
@jag7450 Жыл бұрын
watched so many other videos but still didn't get a clarity on what that code meant. But you explained it very well. Thank you.
@adrianarreguin1739
@adrianarreguin1739 Жыл бұрын
Dude! Thank you! I was so confused in my textbook. Always come to your channel to understand.
@SuperSquall42
@SuperSquall42 10 ай бұрын
You explained this so much clearer than the other videos I watched. Thank you!
@kartikchauhan5209
@kartikchauhan5209 21 күн бұрын
Thanks, the video in python playlist for same topic video no 42 was little confusing , however this one is easy to understand
@AlokTP
@AlokTP 10 ай бұрын
Thank you. I never ever was able to understand this topic so clearly till now.
@universalponcho
@universalponcho 3 жыл бұрын
I've missed watching your videos. I am so happy that I have a reason to again
@Brimstoned_
@Brimstoned_ Жыл бұрын
Dude, Bro Code is the only Human coder in the world that can explain something complex and simplify it.
@mr_ambivalence
@mr_ambivalence 4 жыл бұрын
So, I've just realized that it is needed to be used if you wanna use some function or maybe a variable from a file and don't run it entirely
@tanuj05
@tanuj05 Жыл бұрын
So good !
@imanhosseini6908
@imanhosseini6908 2 жыл бұрын
Organic Chem Tutor of Python
@piotrkopcewicz5227
@piotrkopcewicz5227 2 жыл бұрын
i know that i know nothing :) but in few seconds i will know less nothing and eventaully i will know something. Thx once again !!
@SergioSanchez-zw6mv
@SergioSanchez-zw6mv 2 жыл бұрын
Thanks a lot for this video!
@imanhosseini6908
@imanhosseini6908 2 жыл бұрын
double like
@alastor1419
@alastor1419 2 жыл бұрын
bro this video is like, so underrated
@bekturasanbekov1979
@bekturasanbekov1979 Жыл бұрын
thx 4 vid bro !
@SuperStarEevee
@SuperStarEevee 2 жыл бұрын
Thank you!
@beingzero7541
@beingzero7541 3 жыл бұрын
Wow!
@randalfaris1430
@randalfaris1430 Жыл бұрын
Thank you, I really like your methods in presenting a concept. I do have a comment on this video: But even without this code: if name == main, import (file_name) will be enough to run every code in the imported file. What I mean is that if name main is not essential to access codes from another file. It is also not essential to run a program. I would like to see a program that absolutely cannot work without if name main command.
@arkamukhopadhyay2177
@arkamukhopadhyay2177 3 жыл бұрын
what if the name of the module is __main__? then __main__.__name__ would be __main__ even if it is imported isn't it ? btw would the name __main__ be accepted as a valid name?
@shavindasilva
@shavindasilva 2 жыл бұрын
thank you bro
@uuhju7004
@uuhju7004 3 жыл бұрын
ty bro
@cristiucvladimir7909
@cristiucvladimir7909 9 ай бұрын
Thanks man!
@AbdulRahman-h7z4r
@AbdulRahman-h7z4r 3 ай бұрын
hello
@paantur
@paantur 2 жыл бұрын
@gg-ci5gb
@gg-ci5gb Жыл бұрын
thanks chad This helped a lot
@tomaszkarolak6179
@tomaszkarolak6179 4 жыл бұрын
Thx Bro!!!
@vamsidoddigunta2657
@vamsidoddigunta2657 Жыл бұрын
Hi
@wet_owl_
@wet_owl_ 11 ай бұрын
ty man
@letsflyhigh6883
@letsflyhigh6883 4 жыл бұрын
I'm understanding more now xD
@FushigiMigi
@FushigiMigi 2 жыл бұрын
Mine doesn't work the same 7/22/2022. I wonder if the pycharm software version was updated to work differently.
@thegreatestpotato6460
@thegreatestpotato6460 3 жыл бұрын
So basically its only __main__ within of itself
@vennjylugo7434
@vennjylugo7434 3 жыл бұрын
so basically, its just used during importing modules right?
@oximas-oe9vf
@oximas-oe9vf 2 жыл бұрын
yep
@majorgeneral2812
@majorgeneral2812 Жыл бұрын
You make it easy to understand budda.
@A4n27Mystery
@A4n27Mystery 4 жыл бұрын
Sorry cause this is unrelated to the content of this video. But how do you trim off all the zeros in a printf statement. So for example I have 43.33 as a double and listed as %f.2 but it shows as 43.3300000 in the command prompt. How do I fix it. Thanks in advance
@taijenseng
@taijenseng 3 жыл бұрын
Here you go
@abdallahbadr4335
@abdallahbadr4335 2 жыл бұрын
too late but you can use the round function like that round(number, 2) the second argument is the number of digits after the decimal point
@AnthonyR007
@AnthonyR007 4 жыл бұрын
Yo, what IDE is that? It looks really similar to android studio
@thecodfather7109
@thecodfather7109 4 жыл бұрын
Sublime I think
@notinuserightnoworever
@notinuserightnoworever 3 жыл бұрын
PyCharm
@Jxrdy
@Jxrdy 3 жыл бұрын
@The Codfather YOOOOOOOOOOOOOOOOO 😀👍😀😀
@mujtabahussain7015
@mujtabahussain7015 3 жыл бұрын
@@thecodfather7109 bruhhhh
@hahaupscalinh7872
@hahaupscalinh7872 11 ай бұрын
Wtf?? entendi foi nada kkk
@jhassee
@jhassee 2 жыл бұрын
boobookittyfaq
if __name__ == '__main__' for Python beginners 📥
9:13
Bro Code
Рет қаралды 17 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
Python multithreading 🧵
13:34
Bro Code
Рет қаралды 66 М.
Python multiprocessing ⚡
9:31
Bro Code
Рет қаралды 30 М.
If __name__ == '__main__' for Python Beginners
9:29
Indently
Рет қаралды 22 М.
Python Tutorial: if __name__ == '__main__'
8:43
Corey Schafer
Рет қаралды 2 МЛН
Unpacking Operators in Python: What are * and **?
12:35
NeuralNine
Рет қаралды 10 М.
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 504 М.