这应该在 Python 3.4 中工作吗:
>>> a='tttt'
>>> print(f'a的值为{a}')
最佳答案
我写了一个(糟糕的)thing通过编码技巧启用它们:
首先:
pip install future-fstrings
然后替换编码 cookie(如果你有的话)然后砰! python<3.6
中的 f-strings# -*- coding: future_fstrings -*-
thing = 'world'
print(f'hello {thing}')
运行时:
$ python2.7 main.py
hello world
关于python - f-strings 应该在 Python 3.4 中工作吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38865348/