1.TypeError: must be str, not bytes错误:

解答: 写文件处 open(filename, 'w').write 应该写为 open(filename, 'wb').write,The outfile should be in binary mode.