假设我有一类函数
class A:
def func1():
print(output.of.api)
def func2():
print(output.of.another.api)
#i make the required objects
func1_object = A()
func1_object.func1()
我需要将这些对象的输出写入file.txt
所以我这样做
f = open("file.txt","w")
f.write(func1_object.func())
显然给我一个
的错误TypeError: write() argument must be str,not None
我尝试了基本的Google解决方案,但这些解决方案显然对我不起作用
提前感谢您的帮助!