![](/img/trans.png)
[英]Why does the vale of jaunts (specifically the 1st value) change when I'm not updating jaunts at all? I'm just updating the 'o'
[英]Why I'm getting syntax error on 1st line?
我在PC上安裝了pylint。 但是,例如,當我編寫一些代碼時:
def my_logger(original_func):
import logging
logging.basicConfig(filename = f'{original_func.__name__}.log', level = logging.INFO)
def wrapper(*args, **kwargs):
logging.info(f'Ran with {*args} and {**kwargs}.')
return original_func(*args, **kwargs)
return wrapper
Pylint引發語法錯誤並強調關鍵字“ def”:
invalid syntax(<fstring>, line 1) pylint syntax-error [1,1]
*args
和**kwargs
不是表達式; 它們的語法僅限於某些上下文(例如函數調用,函數聲明,數組文字,多個分配等)。 f字符串{...}
插值器需要一個表達式。
這有效:
logging.info(f'Ran with {args} and {kwargs}.')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.