python with open读写文件 浏览:441

with open( '/path/to/file', 'r' ) as f:
    print( f.read() ) 

with open('/Users/michael/test.txt', 'w') as f:
    f.write('Hello, world!')

推荐文章1
广告