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]
>>> 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)
YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto
Copyright© 矢木 浩人 All Rights Reserved.