我重新开始,谢谢大家的回复
我有一个日志文件,我采取的条目,并删除它的所有垃圾。 剩下的数组或列表是
23
23.23.23.23
45
45.45.45.45
100
34.34.54.13
我想怎么打每一个电话都是用这个
a = 1
while a < 18:
a = a + 2
#logging.debug(line.split(PID_ANDROID)[a])
countIP = a
trySomething()
if a == 20:
break
但我打电话后必须做些事情。 我想使用第一个入口
> do something
> see if something is happening
> if its not goto 3rd entry
> try the same thing again.
这就是我一直坚持的。 因为当我从其他内部调用它时,我使用全局存储。 Python告诉我我不能给我们一个str或turp。或者用下面的代码给我一个列表中所有内容的连续输出
我有这个密码
def trySomething():
global countIP
global LOG_SPLITER
#logging.debug('Processing Number: %s' % (countIP,))
logging.debug(LOG_SPLITER.split(PID_ANDROID)[countIP])
time.sleep(.5)
clearScreen()
#grabBox90()
#lineGoto()
我的问题是。 我怎样才能做一个循环,一次只抽出一个来做一些事情,当我完成一个循环时,就转到下一个循环
如果您只想记录
line
中的每个条目,可以执行以下操作:迭代条目是“更具pythonic性的”
看起来应该使用初始索引为1、步长为2的for循环。或者,对值1使用显式debug语句,然后从3开始循环其余部分,以避免if测试。如果代码的剩余部分是按1而不是2递增,那么这允许您在仍然有循环的情况下正确地执行初始跳过
而不是
Python2
Python3
相关问题 更多 >
编程相关推荐