python清空文件内容

def read_account(filename): with open(filename, 'r+', encoding='utf-8') as f: res = f.readlines() print(res) f.seek(0) f.truncate()

    推荐阅读