所以我写了一个脚本,我需要修复它,这样它就不会以字符串形式写入脚本,请查看其正文中的问题

So i wrote a script and i need to fix it so it doesnt write in the script in string form, see the problem in its body

PyPython.py

from Project import *
v = open("Project.py", "w")
w = open("Backup.txt", "w")
PInput = None
DisableCode = "Save"
LineSeek = 0
Line = "None"
while PInput != DisableCode:
    PInput = input(": ")
    if PInput == "Create Line":
        Line = input("Type in the command: ")
        Line = repr(Line)
        v.write(Line + "\n")
        w.write(Line + "\n")
        print("Done!")

在运行代码之后

在Project.py...

'print("Hi")'

一定是

打印(“嗨”)

我应该如何更改 PyPython.py 以去除 Project.py 中的字符串标记?

这里不需要repr(Line)。 repr() 方法 returns 包含对象的可打印表示的字符串。

尝试删除该行,它将按预期工作。