The basic document processing workflow
1) Open the file, find the file handle and assigned to a variable
2) operating the handle files
3) close the file
# Create a new file named Kam Mi, document reads as follows: Honey heavy frost ember Rebels petition so dear love
# 'GBK' CODEC CAN not decode byte 0xAC in position 14: Illegal multibyte The Sequence, Kam Mi file is a binary string exists on the hard disk, the binary string to the middle of the character encoding, see the lower right corner is 8-UTF # pycharm3 is utf-8 encoding, but the function is not open, the function retrieves the current coding system, the current system is windows, it is gbk; this opens a file stored coded open; mac is utf-8 # If the file format in the hard disk is gbk open should be GBK # open a decoding process, storage memory is coded # build a file Kam seek the same path, as follows, running F = open ( " Jin Mi " , encoding = " UTF-. 8 " ) # give a file handle assigned to f the Data = f.read () Print (the Data) f.close () # honey heavy ember frost # Rebels # petition to make # Dear # love
6 minutes