Created
November 9, 2021 16:54
-
-
Save DerTev/896304b3615c5b95d2949aba19decd36 to your computer and use it in GitHub Desktop.
Python Project-Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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