I've got a problem. I want to write an auto compiler for python, but im so fresh at python, that i dont even know how to write a file multilined. I tried that:
import os
pythonversion = str(input("Pythonversion [no '.']:"))
exename = str(input("Programname:"))
exeversion = str(input("Programversion:"))
exedescription = str(input ("Programdescription:"))
exeoldname = str(input("Programs python file [name.py]:"))
content1 = "from cx_Freeze import setup, Executable"
content2 = 'setup( name = "'+exename+'" , version = "'+exeversion+'", description ="'+exedescription+'" , executables = [Executable("'+exeoldname+'")] , )'
file = open("c:\Python"+pythonversion+"\setup.py","w")
file.write(str(content1))
file.write("/n")
file.write(str(content2))
file.close()
But it didnt work, and /n got just written as string to. pls correct my code, and tell me bout my mistake :)
"c:\Python"write"c:\\Python"orr"c:\Python":) Also it looks a bit nicer to use string formatting instead of"a"+b+"c"+d- seeformat: docs.python.org/2/library/string.html#format-string-syntax or templates: docs.python.org/2/library/string.html#template-strings or even tools like jinja.pocoo.org