Page 46 - Python Cơ Bản
P. 46
print
ɇМG RШM HYRK Xк JMPI
7EY OLM JMPI чɪ QЮ Ю GLЎ чШ чМG XLɳ KМM TLRK XLиG
read([count]) чВ XVϲ ZА XSɧR FШ RШM HYRK GжE JMPI :ɴ Hд
f1 = open('test.txt', 'r')
data = f1.read();
,ɧQ read() Gɹ RLϼR QШX XLEQ WР Pɧ WР PвRK F]XI QYРR
чМG 2ЎY OLɺRK XVY]АR ZɧS XLɳ WЌ чМG LЎX RШM HYRK GжE JMPI
:ɴ Hд
f2 = open('log.txt', 'r')
buffdata = f2.read(1024)
+LM RШM HYRK ZɧS JMPI
2ЎY JMPI чвG QЮ Ю GLЎ чШ Gɹ XLВ KLM XLɳ Gɹ XLВ HɽRK
TLRK XLиG write() чВ KLM QШX RШM HYRK ZɧS JMPI :ɴ Hд