سؤال

I have noticed, in python, that the path to a script can take 2 forms

filename.py

or

filename/__init__.py

What is the reason for this?

هل كانت مفيدة؟

المحلول

simply, if you have a large filename.py containing many classes. you want to split them into separate files, and keep them under the same namespace. you can use the 2nd method.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top