with open("C:scripts/CUAppVersion.js", 'a') as file:
file.write("if [CUID] = -1 then"
"function GetCUID() { return 0; }"
"else"
"function GetCUID() { return [CUID] });")
That is my code and it succesfully puts the JS into the JS file but it puts it on one line rather than as I typed it above. I am aware that my JS code isn't fully correct I do need to fix it.
How do I put that code into the JS file with the correct layout?
Use multiline strings.
with open("C:/scripts/CUAppVersion.js", 'a') as file:
file.write("""
if [CUID] = -1 then
function GetCUID() { return 0; }
else
function GetCUID() { return [CUID] });
""".strip())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With