
| ■ | ファイル入出力の簡単リファレンス |
# -*- coding: sjis -*-
import string, sys
def process():
fin = open("infile2.txt", "r")
fout = open("outfile1.txt", "w")
buf = fin.readline()
while buf != "":
# bufには末尾に改行文字が含まれているので、これを削る
buf = string.strip(buf)
fout.write("[" + buf + "]\n")
buf = fin.readline()
fin.close()
fout.close()
try:
process()
except IOError, e:
print "エラーが発生しました:" + `e`
sys.exit(1)
|
セクションのサブメニューに戻る
(first uploaded 2004/01/11 last updated 2004/01/11)