py-atomic-weights: Python Module for Standard atomic weights of the elements
Features
- IUPAC Atomic Weights in
floatanddecimal.Decimalformats
Usage
pip install atomic-weights
>>> import atomic_weights as atw
>>> print(atw.Fe)
55.845
>>> print(atw.decimal.Fe)
55.845
>>> type(atw.Fe)
<class 'float'>
>>> type(atw.decimal.Fe)
<class 'decimal.Decimal'>
import re
import unicodedata
import atomic_weights as atw
def molecular_mass(x: str) -> float:
"""formula -> g/mol"""
x = unicodedata.normalize("NFKC", x)
y = 0
for elem, num in re.findall(r"(?:([A-Z][a-z]*)(\d+)?)", x):
num = int(num) if num else 1
y += num * getattr(atw, elem)
return y
molecular_mass("Al2O3")
# 101.9600768
molecular_mass("Al₂O₃")
# 101.9600768
Metadata
Release files for atomic-weights 2023.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atomic_weights-2023.1.0.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atomic_weights-2023.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / atomic_weights-2023.1.0.tar.gz
| Download URL | atomic_weights-2023.1.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2174b0f046d74158aa5b518e3c8c68c4828ad47c8937ec3bca08a34ebb40f232
|
|
BLAKE2b-256 checksum How to use checksums |
7daa5239be87c6d8aed95869ed6ebb18f5d7052aecf3b8daf0cac6d86bbf74d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / atomic_weights-2023.1.0-py3-none-any.whl
| Download URL | atomic_weights-2023.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03183f40d4cb68675bf942c0d72c46c312e0b3dc373d9041b66e18a7c7853019
|
|
BLAKE2b-256 checksum How to use checksums |
3bf17c0f0d922e469f240815e741d5fb0ec9b3caf6e3c10309189c86da50350b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|