diff options
author | ptmcg <ptmcg@austin.rr.com> | 2019-01-09 17:18:22 -0600 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2019-01-09 17:18:22 -0600 |
commit | d626c99b6288afc4708d72f668b45a29d3263d22 (patch) | |
tree | 4cbeca134437387022e59b71631246e178393aca /examples/chemicalFormulas.py | |
parent | e9ef507bf1fd41d4bd3ffb0c193e5889254ba340 (diff) | |
download | pyparsing-git-d626c99b6288afc4708d72f668b45a29d3263d22.tar.gz |
Add enumerated place holders for strings that invoke str.format(), for Py2 compatibility
Diffstat (limited to 'examples/chemicalFormulas.py')
-rw-r--r-- | examples/chemicalFormulas.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/chemicalFormulas.py b/examples/chemicalFormulas.py index abbe332..c1df9f3 100644 --- a/examples/chemicalFormulas.py +++ b/examples/chemicalFormulas.py @@ -34,7 +34,7 @@ formula.runTests("""\ C6H5OH
NaCl
""",
- fullDump=False, postParse=lambda _, tokens: "Molecular weight: {}".format(fn(tokens)))
+ fullDump=False, postParse=lambda _, tokens: "Molecular weight: {0}".format(fn(tokens)))
print()
# Version 2 - access parsed items by results name
@@ -47,7 +47,7 @@ formula.runTests("""\ C6H5OH
NaCl
""",
- fullDump=False, postParse=lambda _, tokens: "Molecular weight: {}".format(fn(tokens)))
+ fullDump=False, postParse=lambda _, tokens: "Molecular weight: {0}".format(fn(tokens)))
print()
# Version 3 - convert integers during parsing process
@@ -61,7 +61,7 @@ formula.runTests("""\ C6H5OH
NaCl
""",
- fullDump=False, postParse=lambda _, tokens: "Molecular weight: {}".format(fn(tokens)))
+ fullDump=False, postParse=lambda _, tokens: "Molecular weight: {0}".format(fn(tokens)))
print()
# Version 4 - parse and convert integers as subscript digits
@@ -81,5 +81,5 @@ formula.runTests("""\ C₆H₅OH
NaCl
""",
- fullDump=False, postParse=lambda _, tokens: "Molecular weight: {}".format(fn(tokens)))
+ fullDump=False, postParse=lambda _, tokens: "Molecular weight: {0}".format(fn(tokens)))
print()
|