Python ファイル読み書き
ナビゲーションに移動
検索に移動
Python ファイル読み書き
Python |
ファイルの内容出力
- >>> f = open('/test.txt', 'r')
- >>> for s in f
- >>> print s
- >>>
- :
- >>> f.close()
ファイルに書き込み
- >>> f = open('/test.txt', 'w')
- >>> f.write('this is test.')
- >>> f.close()
ファイルに対してできる操作を確認
- >>> dir(f)
Python 文字コードを指定してファイルを開く
- Python 文字コードを指定してファイルを開く
© 2006 矢木浩人