1. Using open () BIF opens a disk file, creates an iterator to read data from a file, and reads one data row at a time.
2. The ReadLine () method reads a row of data from an open file.
3. The Seek () method can be used to "back" the file to the starting position.
4, Close () method closes a file that was previously opened.
5. The split () method can break a string into a list of strings.
6. A list of constants that cannot be changed in Python is called a tuple (tuple). Once the list data is assigned to a tuple, it can no longer be changed. The tuple is immutable.
7. ValueError will appear when the data does not conform to the desired format.
8. IOError will appear when data is inaccessible (for example, your data file may have been moved or renamed).
9. Help () BIF allows you to access Python documents in the Idel shell.
10. The find () method looks for a specific substring in a string.
11. The NOT keyword negates a condition.
12. The Try/except statement provides an exception handling mechanism that protects some lines of code that may cause run-time errors.
13, the pass statement is a Python empty statement or a null statement, it does nothing.
Note 1:
BIF (built-in functions) is a Python inline function.
In Python or the idle shell, we can type Dir (__builtins__) to see a list of Python's built-in methods ("Builtins" is preceded by two underscores).
NOTE 2:
Help ()
When viewing inline functions, direct help (Open)
When viewing a module, you need to import the module first. For example:
>>> Import String
>>> Help (String)
Help on module string:
NAME
String-a Collection of string operations (most is no longer used).
FILE
/usr/lib/python2.7/string.py
MODULE DOCS
Http://docs.python.org/library/string
DESCRIPTION
Warning:most of the code you see here isn ' t normally used nowadays.
Beginning with Python 1.6, many of these functions is implemented as
Methods on the standard string object. They used to being implemented by
A built-in module called Strop, but Strop was now obsolete itself.
......
Python Toolbox--text Read