DEV Community

Cover image for Python & OpenAI beginner journey 2 | def main()
Gregor Schafroth
Gregor Schafroth

Posted on

Python & OpenAI beginner journey 2 | def main()

For the first few python documents I wrote, I just started writing my code on an empty page, before I learned about main().

For some time I always asked ChatGPT to generate the main function for me since I could never remember how exactly it has to look.

Now I just saved it as a code block in Notion and quickly copy it in my new python program from there.

I’m not sure yet what exactly the best way is to store and reuse code blocks that appear frequently. Does anyone have recommendations?

def main():
    ...

if __name__ == '__main__':
    main()
Enter fullscreen mode Exit fullscreen mode

Top comments (0)