1. The concept of stream. Data exchange usually requires the establishment of two "water pipes".
2, synchronous IO and asynchronous IO. Asynchronous performance is high, but the programming model is complex.
3, Operation IO function is provided by the operating system! Both Java and Pyton are simply encapsulating low-level interfaces for developers to use.
"File Read and write"
Read the file
1, the simple
>>> f = open ('ask.txt'r')>>> F.read () ' I think you must be very busy recently. '>>>
But remember to turn it off (the file object will account for the operating system resources)
>>> F.close ()
However, sometimes reading a file may throw an error, for example: The file does not exist. To ensure that the file is eventually turned off, you must use the Finally statement that will be executed.
Try : = Open ('ask.txt'R') print( F.read ())finally: if f: f.close ()
There is an equivalent notation:
With open ('ask.txt') as F: Print(F.read ())
2.
"Python" IO programming