我在python2中使用pip install future-fstrings
之后的fstrings,如下所示:
# -*- coding: future_fstrings -*-
class A(object):
def __init__(self, **kw):
self.__dict__.update(**kw)
print (f'{self.a}')
print (f'{self.b}')
print (f'{self.c}')
A(a=1,b=2,c=3)
但是,当将这样的文件提交到我的项目中时,我得到:
flake8 (Python 3.6 syntax check).....................(no files to check)Skipped
flake8 (Python 2.7)......................................................Failed
hookid: flake8
file_name:0:1: E999 SyntaxError: unknown encoding: future_fstrings
为什么会发生这种情况?我该如何解决?你知道吗
# noqa E999
没有帮助。。。你知道吗
预提交为每个钩子创建隔离的环境
您需要为该过梁提供未来的f字符串:
完全披露:我是预提交和未来fstrings的作者,也是flake8的维护者,当它们都重叠时,我会很疯狂
相关问题 更多 >
编程相关推荐