Size: 108
Comment:
|
Size: 904
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
<<TableOfContents(2)>> = Input/Output = This lesson deals with the ways of reading and writing data == Basic Python == The [[http://docs.python.org/lib/bltin-file-objects.html|file object]] can be used for reading and writing plain text as well as unformatted binary data. The following code writes a message in the file with the name ''out.txt'', reads and print the data {{{#!python file('out.txt','w').write('Hallo Datentraeger') print file('out.txt').read() }}} * {{{write()}}} writes a string to the file * {{{read()}}} reads complete file * {{{read(N)}}} reads N bytes * {{{readlines()}}} reads the file with linebreaks * {{{readline()}}} reads only the next line == NumPy/SciPy == == HDF == == netCDF == == Various Satellite data formats == |
Input/Output
This lesson deals with the ways of reading and writing data
Basic Python
The file object can be used for reading and writing plain text as well as unformatted binary data. The following code writes a message in the file with the name out.txt, reads and print the data
write() writes a string to the file
read() reads complete file
read(N) reads N bytes
readlines() reads the file with linebreaks
readline() reads only the next line
NumPy/SciPy
HDF
netCDF