Hello, why use separate files and not keep all the information in the main .py file? Also, how does the opening fknow where the file is stored in the hard drive?
@TheOpenSourceChannel2 ай бұрын
Hi @Cukito4, You can keep all the information in the main.py file but separate files keeps your code organized and reusable. When you use open('example.txt', 'r'), you're telling Python the exact location of the file. If you don't specify a path, Python might look in the current working directory for the file.