Previous Article Next Article Python 3 Programming Tutorial – Frequently asked questions
Posted in Python

Python 3 Programming Tutorial – Frequently asked questions

Python 3 Programming Tutorial – Frequently asked questions Posted on May 17, 201830 Comments



Python 3 Programming tutorial Playlist: http://www.youtube.com/watch?v=oVp1vrfL_w4&feature=share&list=PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M

In this python 3 programming tutorial video, the following topics are discussed:
#!/usr/bin/python placed at the top of scripts and if __name__ == “__main__” for the main loops.
#!/usr/bin/python is a shebang line, which notifies Linux of the python path. This allows the script to be executable in Linux.
if __name__ == “__main__” is used by people who distribute their code to others. This allows the code to either be used as a standalone, or to be imported by another script without running the mainloop.

30 comments

  1. Thanks. I never understood the concept of _name_=='__main__' practically. I knew it was used for checking namespace but I didn't realize its practical use.

  2. I guess i am the only person who still doesnt understand. ive looked at so much stuff idk what any of this stuff is. what is name== main ? what is a module? very new to coding

  3. This is the best explanation of this subject, that should be so simple, but as always, other programmers tend to go the long route explaining it. Amazing 5/5.

  4. Love your tutorials! Could you let us know which has been the most challenging python project you've undertaken so far? Thanks and all the best. Cheers from Northeastern BR!

  5. Harrison, thank you so much for explaining if name = '__main__'. I have been wanting to know this for a while, unfortunately I wasnt able to find a clue by reading online. Your explanation is very clear. Now I totally understand why people use it.

  6. +sentdex For some reason I can't import and run the class, I have both files in the same directory. One of them is called "colorsorting" and the other "classtest". "colorsorting" works on its own and I have a copy of main() in the class "color". Whenever I attempt to import colorsorting, "import colorsorting", and run the function, "colorsorting.color()", it only creates a folder in the same directory titled "__pychache__" with a compiled python file of colorsorting.py (titled colorsorting.cpython-34). Any ideas? I'm really new to Python so I may have made a stupid mistake.

  7. Correct me if I'm wrong, but isn't the shebang useful on Windows if you're running multiple versions of Python, so you can specify which should be used?

  8. +sentdex could you say that 'If name equals main' means that if the module name appears in the file you are running then it will activate and use that module? Just trying to get my head around the concept.

  9. Great videos man. Is there a module you would recommend to compare two unicode strings? I want to compare two Chinese language strings and determine their similarity in terms of a value/%. Is NLTK the best approach?

  10. Hi i was wondering what does it mean when it just has () so two brackets with nothing inside them. I have the example of 
    def menu () : . So what do the to brackets mean and the colon. 

  11. Great video series. I was able to quickly and efficiently get acclimated to using python in time for a new college course i am taking last minute. The videos are presented in a logical and easy to understand manner. You've got a knack for teaching friend. 

    Thanks for the work.

Leave a Reply

Your email address will not be published. Required fields are marked *