pythonimportmodule-search-path

Why is there module search path instead of typing the directory name + typing the file name?


Is there an advantage? What is it?


Solution

  • So that everyone doesn't need to have exactly the same file structure on their hard drive? import C:\Python\lib\module\ probably wouldn't work too well on my Mac...

    Edit: Also, what the heck are you talking about with the working directory? You can certainly use modules outside the working directory, as long as they're on the PYTHONPATH.