python读取文件和写入文件的方式

苹果芒 / 2023-06-16 / 原文

 path=os.path.realpath(__file__)
 cwd=os.path.split(path)[0]
 open(cwd+os.path.sep+"usage_result.xls","wb").write(response.content)

上面是写入文件的方式。

那么如果读取文件呢,比如 python如何读取一个excel文件内容呢: