Nun möchte ich das ganze in einer externen settings.ini oder ähnlich speichern, wie ich das erstelle und reinschreiben usw. weiß ich alles aber nicht wie ich einzelne Teile auslese...
Die datei sollte so aussehen:
Code: Alles auswählen
[Profilname]
path=C:\...\...
[Profilname2]
path=C:\...\...
Code: Alles auswählen
#Imports
import os
import time
#Methoden
def mainMenu():
os.system("cls")
print """Welcome to the main Menu
please choose an Option!
1)Change Configs
2)Change the cstrike Location
3)Exit"""
input = raw_input('> ')
if input == "1":
changeCfg()
elif input == "2":
changeLocation()
elif input == "3":
exit()
else:
print "Invalid input"
time.sleep(3)
mainMenu()
def changeLocation():
os.system("cls")
print """Here you can change the path to your cstrike folder!
1)Change the path
2)Abort"""
input = raw_input("> ")
if input == "1":
changePath()
elif input == "2":
mainMenu()
else:
print "Invalid input"
time.sleep(3)
changeLocation()
def changePath():
if os.path.exists() == True:
print "The path exists!"
elif os.path.exists() == False:
print "The path is no existing!"
else:
print "Not possible!"
#Hauptmenue aufrufen
mainMenu()