現在試しにwith openのファイルを書いて操作しているのですが、出力されないパターンがありましたのでお伺いします。
python
1Path_i = 'a.txt' 2path_o = 'b.txt' 3 4with open(path_I,'r') as I: 5 for i in I: 6 with open(path_O,'w') as O: 7 O.write(i) 8
この場合b.txtに反映されないのはなんでなんでしょうか?
回答2件
あなたの回答
tips
プレビュー
現在試しにwith openのファイルを書いて操作しているのですが、出力されないパターンがありましたのでお伺いします。
python
1Path_i = 'a.txt' 2path_o = 'b.txt' 3 4with open(path_I,'r') as I: 5 for i in I: 6 with open(path_O,'w') as O: 7 O.write(i) 8
この場合b.txtに反映されないのはなんでなんでしょうか?
回答2件
あなたの回答
tips
プレビュー
2019/05/23 06:31
2019/05/23 06:33