reference 1: Http://zhidao.baidu.com/link?url=sqj6-1-peWnCAjTYU62i0X6qipUC6nVpfWd8eG0xo1YLj9Aaz_GioIJn_ 5i0oqiwlwfabhonggbwxlmj2uwzf5pgsoxzadyoj5uwtpzaitg
reference 2: http://younglibin.iteye.com/blog/1879377
(1) Read the file by line
(2) Select Remove \ n
To read floating-point data in a file in a regular format:
Http://www.jb51.net/article/49800.htm
http://www.thinksaas.cn/group/topic/92405/
Http://www.jb51.net/article/52077.htm
This indicates that Python reads and writes files as a string. that is, binary, also as a string to see. One character at a byte, enough to save it
Http://www.cnblogs.com/qq78292959/archive/2013/04/07/3003607.html
Summary: Every time learning a language is constantly tangled in this problem! It is a waste of time to hope that this question will not be repeated.
There are two types of stored data:
Method 1: like a C + +, you can press a small block of memory as a unit, the data structure (we do not understand, machine view, binary). Python is no good, there are no pointers, and there are no functions to allocate memory.
Method 2: stored as a string. and in string form. They are in advance to convert values into strings (including scanf,fscanf, printf. What is visible to us) as far as I know, some strategies are:
(1) one row per data
(2) Split by regular (for Python. And C/c++/matlab do not need, have fscanf, note: Read into the format is a person designed, not a bunch of random string. )
(3) As mentioned in reference 1, the use of the list is read by line, not pro-test.
So? The regular expression of the scripting language is to understand!
Python Read and write files