Size: 329
Comment:
|
Size: 710
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 14: | Line 14: |
The file object is used for reading and writing plain text as well as unformatted binary data. The following Codeline writes a message in the file with the name ''out.txt'' {{{#!python file('out.txt','wb').write('Hallo Datentraeger') }}} The data can be read in with the method '''.read()''' {{{#!python s=file('out.txt').read() print s 'Hallo Datentraeger' }}} |
Input/Output
This lesson deals with the ways of reading and writing data
Basic Python
The file object is used for reading and writing plain text as well as unformatted binary data. The following Codeline writes a message in the file with the name out.txt
1 file('out.txt','wb').write('Hallo Datentraeger')
The data can be read in with the method .read()
NumPy/SciPy
HDF
netCDF