python substring not found_Python值错误:找不到子字符串

在尝试执行Python代码时遇到了'ValueError: substring not found'的问题,该错误发生在20_a_star_algorithm.py文件的第66行。在尝试创建节点时,代码试图在某个值中查找子字符串,但未找到。具体问题可能涉及到StateString类的初始化过程中计算距离的方法get_dist()。教程来源为特雷弗·佩恩的一篇教程。寻求帮助以解决这个调试难题。
摘要由CSDN通过智能技术生成

我一直在写这段代码,到现在为止我已经试着调试了将近一天,但是我看不出问题出在哪里。在

我在66行停止调试器。

当我进入或越过代码时,我会收到一条错误消息。在Traceback (most recent call last):

File "/home/johan/pycharm-community-4.5.3/helpers/pydev/pydevd.py", line 2358, in

globals = debugger.run(setup['file'], None, None, is_module)

File "/home/johan/pycharm-community-4.5.3/helpers/pydev/pydevd.py", line 1778, in run

pydev_imports.execfile(file, globals, locals) # execute the script

File "/home/johan/sdp/lets_learn_python/20_a_star_algorithm.py", line 87, in

a.solve()

File "/home/johan/sdp/lets_learn_python/20_a_star_algorithm.py", line 66, in solve

closest_child.create_children()

File "/home/johan/sdp/lets_learn_python/20_a_star_algorithm.py", line 48, in create_children

child = StateString(val, self)

File "/home/johan/sdp/lets_lea

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值