Compare commits
2 Commits
4946d65fc7
...
08b6ec53fd
Author | SHA1 | Date | |
---|---|---|---|
08b6ec53fd | |||
aa659bd383 |
@ -12,13 +12,15 @@ What you find in this repo is a small python-libary that connects to the ecb to
|
|||||||
## Usage
|
## Usage
|
||||||
You probably want to use this tool using the cli-interface which tries to understand requests in human language.
|
You probably want to use this tool using the cli-interface which tries to understand requests in human language.
|
||||||
To reference the currencies use €, eur, euro, e, E, or µ, meu, meuro, m, M;
|
To reference the currencies use €, eur, euro, e, E, or µ, meu, meuro, m, M;
|
||||||
|
Currencies should be an integer or have 2 digits after the point (.).
|
||||||
Dates should always be dd.mm.YYYY or dd.mm.yy
|
Dates should always be dd.mm.YYYY or dd.mm.yy
|
||||||
If no date is supplied (or understood) the current date is used.
|
If no date is supplied (or understood) the current date is used.
|
||||||
Examples:
|
Examples:
|
||||||
#### ./meuro.py What is 200 eur in meuro
|
#### ./meuro.py What is 200 eur in meuro
|
||||||
#### ./meuro.py 200 meur at 12.12.2012
|
#### ./meuro.py 120.50 meur at 12.12.2012
|
||||||
#### ./meuro.py 200€ 10.10.2010
|
#### ./meuro.py 50,000€ 10.10.2010
|
||||||
#### ./meuro.py I want to know how much 200€ from 11.11.2011 are in meuro.
|
#### ./meuro.py I want to know how much 2000€ from 11.11.2011 are in meuro.
|
||||||
|
#### ./meuro.py 3.14E 01.02.2003 12:34
|
||||||
### Python-API
|
### Python-API
|
||||||
You can also import this libary from another python file
|
You can also import this libary from another python file
|
||||||
##### The provided functions are:
|
##### The provided functions are:
|
||||||
|
2
meuro.py
2
meuro.py
@ -80,7 +80,7 @@ def _extractDate(s):
|
|||||||
|
|
||||||
def cliInterface():
|
def cliInterface():
|
||||||
import sys, re
|
import sys, re
|
||||||
arg = " ".join(sys.argv[1:])
|
arg = " ".join(sys.argv[1:]).replace(',','')
|
||||||
reFromEur = re.compile(r'(\d+(.\d\d)?)\W?(€|e|E)')
|
reFromEur = re.compile(r'(\d+(.\d\d)?)\W?(€|e|E)')
|
||||||
reFromMeur = re.compile(r'(\d+(.\d\d)?)\W?(μ|m|M)')
|
reFromMeur = re.compile(r'(\d+(.\d\d)?)\W?(μ|m|M)')
|
||||||
if (m := reFromEur.search(arg))!=None:
|
if (m := reFromEur.search(arg))!=None:
|
||||||
|
Loading…
Reference in New Issue
Block a user