파일 - 파일 입출력

>>> 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 : ... 57 : 58 : 59 : 60 : 61 : 62 : 63 : 64 : 65 : ... 91 : 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:
239527
Today:
179
Yesterday:
712