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()
0
Subscribe to my newsletter

Read articles from Gregor Schafroth directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Gregor Schafroth
Gregor Schafroth

Entrepreneur & Junior Programmer, currently learning how to build an OpenAI Assistant's API Chat-bot app with Python, Flask, Heroku, Celery, Redis, etc.