Regarding the method of specifying the print format in Python, I tried the following comment method. http://qiita.com/Shogo-Sekine/items/e42ddb9b47d36f8b5cba#comment-07f18428812589475fa8
PEP seems to correspond to the following. https://www.python.org/dev/peps/pep-0498/
Is it the term "F-strings"?
I tried with ideone. https://ideone.com/tWyBaj
compilation info
Traceback (most recent call last):
File "/usr/lib/python3.5/py_compile.py", line 125, in compile
_optimize=optimize)
File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "./prog.py", line 4
print(f'pi:{pi}, napier:{napier}')
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.5/py_compile.py", line 129, in compile
raise py_exc
py_compile.PyCompileError: File "./prog.py", line 4
print(f'pi:{pi}, napier:{napier}')
^
SyntaxError: invalid syntax
As of August 29, 2017, the Python version of ideone seems to be 3.5. v3.6 code snippet
Recommended Posts