Why is Python giving me “an integer is required” when it shouldn't be?

前端 未结 4 1100
自闭症患者
自闭症患者 2020-12-19 06:28

I have a save function within my Python program which looks like this:

def Save(n):
    print(\"S3\")
    global BF
    global WF
    global PBList
    globa         


        
4条回答
  •  Happy的楠姐
    2020-12-19 06:52

    You need to escape your strings: a \ in a string is an escape character.

    Either escape the slashes:

    "C:\\KingsCapture\\Test\\List.txt"
    

    or use Raw strings:

    r"C:\KingsCapture\Test\List.txt"
    

提交回复
热议问题