如何在Python中使用“ with open”打开多个文件?

我想一次更改几个文件, 前提是我能够写入全部文件。 我想知道我是否能够将多个打开调用与with语句结合with : html try: with open('a', 'w') as a and open('b', 'w') as b: do_something() except IOError as e: print 'Operation failed: %s' % e.strer
相关文章
相关标签/搜索