#-*- coding:UTF-8 -*-
def wfile():
try:
filename = "C:\\Users\\zh\\"+"test.html"
except IOError:
print("file creat error")
else:
fp = open(filename,'wb')
fp.write('test'.encode('utf-8'))
fp.close()
def rfile():
try:
filename = "C:\\Users\\zh\\"+"test.html"
fp = open(filename,'r')
except IOError:
print("file open error")
else:
for f in fp:
print("file data is "+f)
fp.close()
if __name__ == '__main__':
#readSQL()
wfile()
rfile()
print('Done!')