How to Use File I/O ?
File Read
file = open('fileName.text','r')
// All files Read
file.read()
// line Reading at first
file.readline()
// read line at third
file.readline(3)
// All Read Lines
file.readlines()
file.close()
File Write
file = open('fileName.text','w')
//write file
file.write('hello World!')
file.write('hello Python')
file.close()
//array write in file
file = open('fileName.txt','w')
mylist = ['hi', 'koboso','this is python file wirte']
file.writelines(mylist)
file.close()
누구나 파이썬 -3 (연산자, if, for) (0) | 2019.12.22 |
---|---|
누구나 파이썬 -2 (문법 , 자료형) (0) | 2019.12.13 |
누구나 파이썬 -1 (파이썬 설치하기 2.7.1 version) (0) | 2019.12.12 |
Python HTTP Networking request (308) | 2018.12.18 |
Python Simple socket Networking programming [ Echo Server / Echo Client ] (0) | 2018.11.20 |
Python 환경변수 지정법. (0) | 2018.11.20 |