修正5.2小节的bug~

This commit is contained in:
XiongNeng
2015-09-17 23:20:07 +08:00
parent b2df706374
commit 2ad0afec61
2 changed files with 3 additions and 3 deletions

View File

@@ -16,12 +16,12 @@
.. code-block:: python
with open('somefile.txt', 'rt') as f:
with open('d:/work/test.txt', 'wt') as f:
print('Hello World!', file=f)
----------
讨论
----------
关于输出重定向到文件中就这些了。但是有一点要注意的就是文件必须是以文本模式打开。
如果文件二进制模式的话,打印就会出错。
如果文件二进制模式的话,打印就会出错。