Mimics Fortran textual IO in Python
Project description
Generates text from a Python list of variables or will read a line of text into Python variables according to the FORTRAN format statement passed.
Licensed under the MIT license
The library is extensively unit-tested (but not yet extensively user-tested, please report bugs!) against the Intel FORTRAN compiler on a Linux platform. Differences between platforms/compilers are generally minor.
The following is a quistart, full docs are found at the project page wiki!.
To read Fortran records,:
>>> import fortranformat as ff >>> header_line = ff.FortranRecordReader('(A15, A15, A15)') >>> header_line.read(' x y z') [' x', ' y', ' z'] >>> line = FortranRecordReader('(3F15.3)') >>> line.read(' 1.000 0.000 0.500') [1.0, 0.0, 0.5] >>> line.read(' 1.100 0.100 0.600') [1.1, 0.1, 0.6]
To write Fortran records,:
>>> import fortranformat as ff >>> header_line = ff.FortranRecordWriter('(A15, A15, A15)') >>> header_line.write(['x', 'y', 'z']) ' x y z' >>> line = FortranRecordWriter('(3F15.3)') >>> line.write([1.0, 0.0, 0.5]) ' 1.000 0.000 0.500' >>> line.write([1.1, 0.1, 0.6]) ' 1.100 0.100 0.600'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file fortranformat-0.2.4.zip
.
File metadata
- Download URL: fortranformat-0.2.4.zip
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e46e019c1107de9cc7d1b68af9c160c997e93ef292ed617758c64c1c5a350b9b |
|
MD5 | bf0f8683a4038665f4089229b2518f01 |
|
BLAKE2b-256 | 6e72858a79507f76924c072984c7efbf8e90d8d1d19783d9b5b0fa2212921766 |
File details
Details for the file fortranformat-0.2.4.tar.gz
.
File metadata
- Download URL: fortranformat-0.2.4.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d6842f6f9e1c7cec465d868b3d05312810da71cfef3e67447dba6836d3e665 |
|
MD5 | c332ab9c19a83946056fd1d51f17283f |
|
BLAKE2b-256 | 902e39169aad7e42bdf89ab922910ea75130f4c2097340465f2238f3752ea3b5 |
File details
Details for the file fortranformat-0.2.4.win-amd64.exe
.
File metadata
- Download URL: fortranformat-0.2.4.win-amd64.exe
- Upload date:
- Size: 248.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69ebdc375b20bb2a1ce06907012ebf679b5974442350703b5b755bbc2b4be012 |
|
MD5 | 85af6d1c7e247eb1ec74abe7a078b8d3 |
|
BLAKE2b-256 | e56b231f8afa9993874f440b9adad5159b3b232a5c1b73b04f8e8743e8b9b90a |