Python 遇到的问题

本文列举了Python编程中常见的23种错误,包括PyCharm的错误提示、类型错误、索引错误、导入错误、文件操作错误、递归深度错误、属性错误等,并提供了相应的解决方案,帮助开发者解决Python开发过程中的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

问题1:Pycharm 项目中  Cannot find declaration to go to

问题2:TypeError: list indices must be integers or slices, not tuple

问题3:Python 报错IndexError: list index out of range

问题4:Python + Pytest 参数化  原理 

问题5:类型数据分析中 ImportError: cannot import name 'XXX' from 'XXX'

问题6:代码正常 driver = webdriver.Remote(“http://localhost:4723/wd/hub“, caps)

问题7:年久失修的代码 AttributeError: module 'selenium.webdriver.android.webdriver' has no attribute 'Chrome'

问题8:TypeError: XXX missing 1 required positional argument: 'self'

问题9:内置函数写入文件TypeError: write() argument must be str, not int

问题10:TypeError:'XXX' not supported between instances of 'int' and 'list'

问题11:装饰器 TypeError:XX  missing X required positional arguments “XXX”

问题12:RecursionError: maximum recursion depth exceeded while calling a Python object

问题13:maximum recursion depth exceeded in comparison

问题14:AttributeError: 'str' object has no attribute 'X'

问题15:non-default parameter follows default parameter

问题16:FileNotFoundError: [Errno 2] No such file or directory: 'X'

问题17:PermissionError: [Errno 13] Permission denied: 'X'

问题18:requests.exceptions.SSLError: HTTPSConnectionPool(host='haokan.baidu.com', port=443): Max retries exceeded

问题19:TypeError: Metafunc.parametrize() takes from 3 to 6 positional arguments but 9 positional arguments (and 1 keyword-only argument) were given

问题20:TypeError: 'str' object is not callable

问题21:TypeError: 'XXX' object is not iterable

问题22:NameError: name 'list_A' is not defined. Did you mean: 'list'?

问题22:can only concatenate str (not "dict") to str

问题23:AttributeError: 'NoneType' object has no attribute 'sheetnames'



问题1:Pycharm 项目中  Cannot find declaration to go to

原因:Pycharm编译环境发生变化了;使用 CTRL + 鼠标键

注意:不要使用翻墙软件下载第三方依赖 

尝试ctrl+鼠标左键进入该类,提示“Cannot find declaration to go to”或者“Cannot find bean with qualifier ‘*********’”

①导入项目的时候使用的是Open (不重要)

②检查python第三方库是否安装,使用命令  pip show selenium (

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AMING20220827

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值