简体   繁体   English

语法错误打印(*args,**kwargs)

[英]SyntaxError print(*args, **kwargs)

I've got an error as a traceback below:我有一个错误作为回溯如下:

Traceback (most recent call last):
  File "setup_rouge.py", line 7, in <module>
    from files2rouge import settings
  File "/home/cerdas/files2rouge/files2rouge/__init__.py", line 2, in <module>
    from files2rouge.files2rouge import main
  File "/home/cerdas/files2rouge/files2rouge/files2rouge.py", line 17, in <module>
    from files2rouge import utils
  File "/home/cerdas/files2rouge/files2rouge/utils.py", line 14
    print(*args, **kwargs)
          ^
SyntaxError: invalid syntax

The error occured when I'm trying to run this code:当我尝试运行此代码时发生错误:

def tee(saveto, *args, **kwargs):
    """Mimic the tee command, write on both stdout and file
    """
    print(*args, **kwargs)
    if saveto is not None:
        print(file=saveto, *args, **kwargs)

I've read and searched for similar problems, but I still can't solve the error.我已经阅读并搜索了类似的问题,但我仍然无法解决错误。

尝试使用print(args, kwargs)而不是print(*args, **kwargs)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM