python使用open经常报错:TypeError: an integer is required的解决方案

错误是由于从os模块引入了所有的函数导致的,os模块下有一个open函数,接受整型的文件描述符和打开模式,from os import *引入os模块的open函数,覆盖了python内建的open函数,导致错误。
删除from os import *这行,然后再根据需要,指定引入os模块下的函数

建议任何时候都不要使用from module import *方式引入模块函数。
原文地址:https://www.cnblogs.com/hltswd/p/5678608.html