当前位置:网站首页>Syntaxerror resolved: positive argument follows keyword argument
Syntaxerror resolved: positive argument follows keyword argument
2022-07-28 00:52:00 【No envy】
resolved (Python Position parameter error )SyntaxError:positional argument follows keyword argument
List of articles
Error code
My code :
with open("text.txt", encoding='utf-8', "r") as f:
f.read()
Error message :
File "E:/Python Study /1.py", line 1
with open("text.txt", encoding='utf-8', "r") as f:
^
SyntaxError: positional argument follows keyword argument

Error reason
Translation of error reporting content : Grammar mistakes : Positional parameters follow keyword parameters
Error reason : There's this bug The reason is that the parameter position is incorrect ( Positional arguments , Sometimes called a required parameter , It means that the actual parameters must be passed to the function in the correct order , let me put it another way , The number and location of the actual parameters passed in when calling a function must be the same as when defining the function ), Keyword parameters must follow positional parameters . because python When the function parses parameters , It's in order , The position parameter must first meet , To consider other variable parameters .
resolvent
Modify code parameter location :
with open("text.txt", "r", encoding='utf-8') as f:
f.read()
Run again successfully :
边栏推荐
- Camera and lidar calibration: gazebo simulation livox_ camera_ lidar_ Calibration ---- external parameter calibration calculation and result verification
- 融云 IM & RTC 能力上新盘点
- 【Leetcode】547.省份数量(中等)
- ASML launched the first generation HMI multi beam detector: the speed is increased by 600%, which is suitable for 5nm and more advanced processes
- Map set
- Network equipment hard core technology insider firewall and security gateway chapter (VI) security double repair under the law
- 小波变换学习笔记
- Buildforge materials
- FFT 采样频率和采样点数的选取
- 投资80亿!南京华天封测一期项目即将投产!
猜你喜欢
随机推荐
Invest 8billion! Nanjing Huatian sealed test phase I project is about to be put into production!
[must read for new products] valuation analysis of Meishi technology, distributed audio-visual products and Solutions
Rendering problems
Redis transaction and optimistic lock
Basic operations of MySQL database (I) --- Based on Database
Matlab | those matlab tips you have to know (2)
Ali Er Mian: why do we need to separate databases and tables?
The Canadian court found Meng Wanzhou guilty of "dual criminality", and the extradition procedure will continue!
Leetcode 415. string addition and 43. string multiplication
投资80亿!南京华天封测一期项目即将投产!
Camera and lidar calibration: gazebo simulation livox_ camera_ lidar_ Calibration ---- external parameter calibration calculation and result verification
The server is poisoned - the dish is the original sin
激活最大化
Promoting cloud network integration and building a digital economy: Intel unveiled the 5th Digital China Construction Summit - cloud ecosystem Conference
Code review tool
Matlab | those matlab tips you have to know (3)
单片机之led、数码管与按键
Jericho will make a popping sound when turning on, broadcasting a prompt tone, and turning off [chapter]
The influence of head zeroing and tail zeroing on FFT output
startUMl






![[CruiseControl]Build Result JSP](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)


