Skip to content

Instantly share code, notes, and snippets.

@bigntallmike
Last active April 12, 2025 18:06
Show Gist options
  • Save bigntallmike/4fd3dd235722418de14e92e0146fd6f3 to your computer and use it in GitHub Desktop.
Save bigntallmike/4fd3dd235722418de14e92e0146fd6f3 to your computer and use it in GitHub Desktop.
Python beginner tip 1
#!/usr/bin/python3
#
# Instead of just typing:
print("hello world")
# Do this (main is a placeholder; the actual thing it does is better):
def main():
print("hello world")
# This will only be called if you run this file directly.
# If it is for instance imported by another file, it will not run this:
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment