https://github.com/xmcp/chemcalc
计算原子量的有力工具 (非清真)
https://github.com/xmcp/chemcalc
calculator chemistry lexer ply
Last synced: 2 months ago
JSON representation
计算原子量的有力工具 (非清真)
- Host: GitHub
- URL: https://github.com/xmcp/chemcalc
- Owner: xmcp
- Created: 2016-07-06T13:50:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-26T13:31:08.000Z (over 7 years ago)
- Last Synced: 2025-02-28T09:24:01.722Z (8 months ago)
- Topics: calculator, chemistry, lexer, ply
- Language: Python
- Size: 8.79 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ChemParser
计算原子量的有力工具 *(非清真)*## 使用方法
安装依赖:`py -3 -m pip install -r requirements.txt`用 chemparser 解释化学式:
```python
>>> import chemparser
>>> chemparser.parser.parse('Fe2(SO4)3')>>> _.mats
{'S': 3, 'O': 12, 'Fe': 2}
```用 chemcalc 进行关于分子量的计算(支持四则运算、括号、负号、化学式和科学计数法)
```python
>>> import chemcalc
>>> chemcalc.parser.parse('304 * Fe / FeSO4')
Fraction(112, 1)
>>> chemcalc.parser.parse('- 1e3 / CH4')
Fraction(-125, 2)
```## 附赠:良心™计算器
`LXcalc.pyw`