Python versions 3.5 do not allow keyword arguments after "expression
时间: 2024-04-14 11:25:37 浏览: 54
Mac中升级Python2.7到Python3.5步骤详解
This error occurs in Python 3.5 when you try to pass keyword arguments after an expression. In Python 3.5 and earlier versions, keyword arguments must be passed before any positional arguments. To resolve this issue, you need to rearrange your code so that the keyword arguments are placed before the expression or positional arguments. Here's an example:
```python
# Incorrect code (Python 3.5 and earlier)
some_function(arg1, arg2, keyword_arg1=value1, keyword_arg2=value2)
# Corrected code
some_function(keyword_arg1=value1, keyword_arg2=value2, arg1, arg2)
```
By following this syntax, you can avoid the "keyword arguments after expression" error in Python 3.5.
阅读全文