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

前端 未结 4 1097
自闭症患者
自闭症患者 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条回答
  •  自闭症患者
    2020-12-19 06:50

    As DSM noted, you're using http://docs.python.org/library/os.html#os.open instead of built-in open() function.

    In os.open() the second parameter (mode) should be integer instead of string. So, if you ought to use from os import * then just substitute mode string with one of the following args:

    • os.O_RDONLY
    • os.O_WRONLY
    • os.O_RDWR
    • os.O_APPEND
    • os.O_CREAT
    • os.O_EXCL
    • os.O_TRUNC

提交回复
热议问题