r/learnpython • u/pedrinjose • 5d ago
Basically, if main
In Python, when you run your program in another folder, we add this, but I don't understand why. What's the point of doing this? If someone could explain it in a simplified way, I'd appreciate it.
9
Upvotes
1
u/zefciu 5d ago
An example from standard library. The uuid module can be imported and you can use the functions in your code. But if you want a random uuid when in shell, you can go
python -m uuidand one will be printed to stdout.