Skip to content

Instantly share code, notes, and snippets.

@DerTev
Created November 9, 2021 16:54
Show Gist options
  • Save DerTev/896304b3615c5b95d2949aba19decd36 to your computer and use it in GitHub Desktop.
Save DerTev/896304b3615c5b95d2949aba19decd36 to your computer and use it in GitHub Desktop.
Python Project-Setup
#!/usr/bin/env python3
from os.path import isdir
from os import mkdir
from os import chmod
from os import system
project_name = input("Projektname: ")
if isdir(project_name):
print("Dieses Projekt gibt es bereits!")
else:
mkdir(project_name)
open(f"{project_name}/main.py", "w").write("print(\"Hello, world!\")\n"
"print(\"Created with ProjectSetup.py by DerTev\")")
open(f"{project_name}/start.sh", "w").write("python3 main.py")
chmod(f"{project_name}/start.sh", 0o777)
mkdir(f"{project_name}/utils")
open(f"{project_name}/utils/__init__.py", "w").write("")
system(f"cd {project_name} && git init")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment