파일 - 파일 입출력

>>> import sys, os, re, glob, string

>>> os.getcwd()
'C:\\Python25' # 현재 경로


>>> f = open("test.txt")
>>> f.read()
'Programming is fun.\n\nVery fun!\n\n \n\nYou have to do it yourself...\n'

>>> buffer = f.read()
>>> print buffer
Programming is fun.


Very fun!



You have to do it yourself...


>>> f = open("letter.txt","w")
>>> f.write("Dear Father~! ")
>>> f.close()
>>> f = open("letter.txt");f

>>> f.read()
'Dear Father~! '
>>> f = open("letter.txt","a+")
>>> f.write ("\n How are You?")
>>> f.close()
>>>
>>>
>>>
>>>
>>> f = open("letter.txt");f.read()
'Dear Father~! \n How are You?'
>>> f = open("letter.txt");buffer = f.read(); buffer;
'Dear Father~! \n How are You?'
>>> f = open("letter.txt");buffer = f.read(); buffer;
'Dear Father~! \n How are You?'
>>> f = open("letter.txt");
>>> buffer = f.read();
>>> print buffer
Dear Father~!
How are You?
>>>
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2008/05/27 17:51 2008/05/27 17:51
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/3311

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/3311

« Previous : 1 : ... 3118 : 3119 : 3120 : 3121 : 3122 : 3123 : 3124 : 3125 : 3126 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/11   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Statistics Graph

Site Stats

Total hits:
242173
Today:
703
Yesterday:
1266