【发布时间】:2013-11-08 04:44:32
【问题描述】:
我想知道 python 中是否有一些特定的东西可以简单地表示任何整数。具体来说,我想知道这一点,以便我可以使用所说的特定内容(我猜是符号或内置函数)在搜索算法中使用。这样我就不必精确地搜索正确的数字,只需搜索具有 2 个正确数字和一个整数正数的第一组数据。
这是我使用的代码:
def pheromone():
'''function to measure the level of pheromone (whilst slowly depleting that level) in the grid cells in order to increase or decrease the likelihood an ant will choose that grid cell'''
grid_list[grid_list.index([ant_position[0],ant_position[1],SOMESYMBOL])]
网格列表是一个包含列表的列表。因此,我从网格列表中搜索第一个列表,以获得我正在寻找的两个设定值(ant_position[0] 和 ant_position[1])和一个任意值,可以想象,这里显示为 SOMESYMBOL 的任何整数正数。
有人有什么想法吗?
【问题讨论】:
标签: python list function search numbers