fortran-format-converter
Convert Fortran format specifiers to Python format strings.
Requirements
Python 3.5 or greater
Installation
fortran-format-converter is on PyPI so the easiest way to install it is:
$ pip install fortran-format-converter
Usage
Currently fortran-format-converter only handles simple conversions and in a single direction, Fortan -> Python.
We begin by importing the converter.
import fortran_format_converter as ffc
Now to convert a Fortran style format specification to a Python format string is as simple as supplying the convert function with the Fortran formatting specification.
>>> ffc.convert('F6.2')
'6.2f'
Most types of Fortran format specifications are supported, such as binary.
>>> ffc.convert('B16.16')
'016b'
If an invalid format string is given an error will be raised.
>>> ffc.convert('J4')
Traceback (most recent call last):
...
ValueError: 'J4' is not a valid Fortran format specifier
Sometimes it may be desirable to parameterized the format. This can be accomplished with the width, align, and precision fields of the Format class.
>>> format = ffc.Format('F5.2')
>>> '{:{width}.{prec}f}'.format(2.718281828459, width=format.width, prec=format.precision)
2.72
Metadata
Release files for fortran-format-converter 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fortran-format-converter-0.1.3.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fortran_format_converter-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / fortran-format-converter-0.1.3.tar.gz
| Download URL | fortran-format-converter-0.1.3.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
389fa8bc3ee46c0fdae7dd930c9fa6f0582755ffbb4a6bbb97e8559c2feb5559
|
|
BLAKE2b-256 checksum How to use checksums |
e7d22edd076fc506f3e0ba3cb29c7bd81c43e07c3c7f25ee4f78379531cf260d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / fortran_format_converter-0.1.3-py3-none-any.whl
| Download URL | fortran_format_converter-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df92d4ebad750f9d043143abef6517f82d676af6c0f7f21ca561996888d58192
|
|
BLAKE2b-256 checksum How to use checksums |
9a92abfc900b7746742e99db17cab6584680a803f484508eb9f35409a5d60fca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Security for fortran-format-converter 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.