-
-
Save torokati44/5866f6e9b27190dc219e29fdc71d8a0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import quantities as pq | |
def parse_quant(s: str): | |
m = re.match(r"([0-9.,eE+-]+)\s*([a-zA-Z_]*)", s) | |
return pq.Quantity(float(m.group(1)), m.group(2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment