** 《经济及社会理事会正式记录,2008年,补编第5号》(E/2008/44)。
我写了一部拖网渔船,该拖网 and和 par子。
在第一版中,为了获得下一个有效页,I正在增加URL ID,并将无有效身份识别资料保存到档案中,在我注意到大多数有效身份识别器有返回后,有效的URLs被移至符合我需要的内容的传译员。
我做了一些统计,并读到该次复述清单——[8,18,7,17,6,16,5,15]。
见https://stackoverflow.com/questions/6809402/python-maximum-recursion-exceed-while-questing-a-python-object。 改为:
def checkNextID(ID):
numOfRuns = 0
global curRes, lastResult
while ID < lastResult:
try:
numOfRuns += 1
if numOfRuns % 10 == 0:
time.sleep(7) # sleep every 10 iterations
numOfRuns = 0
if isValid(ID + 8):
parseHTML(curRes, ID)
ID = ID + 8
elif isValid(ID + 18):
parseHTML(curRes, ID)
ID = ID + 18
elif isValid(ID + 7):
parseHTML(curRes, ID)
ID = ID + 7
elif isValid(ID + 17):
parseHTML(curRes, ID)
ID = ID + 17
elif isValid(ID+6):
parseHTML(curRes, ID)
ID = ID + 6
elif isValid(ID + 16):
parseHTML(curRes, ID)
ID = ID + 16
elif isValid(ID + 5):
parseHTML(curRes, ID)
ID = ID + 5
elif isValid(ID + 15):
parseHTML(curRes, ID)
ID = ID + 15
else:
if isValid(ID + 1):
parseHTML(curRes, ID)
ID = ID + 1
except Exception, e:
print "something went wrong: " + str(e)
<>strong>isValid()是一种功能,可取得一个识别+一个子背书和返回。 如果该圆顶包含我所需要的内容,并且把该圆顶的垫子拯救到一个叫做“曲线”的全球变数上,那么如果该圆顶的斜线含有我所需要的数据,并且拯救了该圆形的坏片。
<>strong>parse/2006/2/strong>是一种功能,可获取大物体(curRes),按我需要的数据进行分类,然后将数据保存到一栏,然后返回。
在一个完美的世界上,一部法典将成为我所需要的一切工具,以掌握所有有效的身份证(在5M系列中大约有400K),它给我带来了更小的时间(x50更快)。
英国广播公司在缩小任何有效URL的幅度时,其代码非常低效,因此,I m 拖网在每艘航程中多半是相同的URLs,这是因为,我把该身份证增加一个以便保持进展,直到我找到下一个有效的URL,然后是Im 核对ID+8, 即18, 17 等,这有时使我在以前的电离中检查同样的URLs I。
so I went and changed the code so it will keep a a set of non-valid URLs which I ll avoid checking again and I can t get it to work, I m breaking my head for a few hours now, it s not working like it should.
这是我的新职能:
def checkNextID(ID):
runs = 0
badTries = set()
diff = [8,18,7,17,6,16,5,15,1]
global curRes, lastResult
while ID < lastResult:
if len(badTries) == 100: #every 100 non-valid IDs I can reset badTries(I think), if I ve increased the ID 100 times it means I won t be checking previous IDs and I can start saving the non-valid IDs again.
badTries = set()
try:
for i in diff:
tryID = ID + i #tryID will be the ID + one of the subtrahends.
if tryID not in badTries: #if we haven t already tried that ID
if runs % 10 == 0:
time.sleep(6) #sleep every 10 requests
if isValid(tryID):
runs += 1
parseHTML(curRes, ID)
ID = tryID
badTries = set() #I can reset the badTries now, I m moving forward.
break #will move to the next id.
else:
badTries.add(ID) #save the non-valid ID to the set
if i == 1: #it s the last iteration of the for loop, if the subtrahend is 1 and it s not valid I must increase the ID by 1 in order to go forward.
ID += 1
else:
ID += 1 #if the ID is not a valid ID and I ve already checked it I must increase the ID by one or I ll get into an infinite loop.
except Exception, e:
print "something went wrong: " + str(e) + ID - + str(ID)
Im 为每套无有效身份识别器,在每次要求Valid()之前 如果我已经尝试过这个身份证,那么,如果Im 电话是Valid(Valid),否则,ID就会增加一个。
that bad bad file
513025328
513025317
513025327
513025316
513025326
513025312
513025320
513025330
513025319
513025329
513025318
513025328
513025317
513025327
513025313
513025321
513025331
513025320
513025330
513025319
513025329
513025318
513025328
513025314
513025322
513025332
513025321
513025331
513025320
513025330
513025319
513025329
513025315
513025323
513025333
513025322
513025332
513025321
513025331
513025320
513025330
513025316
513025324
513025334
513025323
513025333
513025322
513025332
513025321
513025331
513025317
513025325
513025335
513025324
513025334
513025323
513025333
513025322
513025332
513025318
513025326
513025336
513025325
513025335
513025324
513025334
513025323
513025333
513025319
513025327
513025337
513025326
513025336
513025325
513025335
513025324
513025334
513025320
513025328
513025338
513025327
513025337
513025326
513025336
513025325
513025335
513025321
513025329
513025339
513025328
513025338
513025327
513025337
513025326
513025336
513025322
513025330
513025340
513025329
513025339
513025328
513025338
513025327
513025337
513025323
513025331
513025341
513025330
513025340
513025329
513025339
513025328
513025338
513025324
513025332
513025342
513025331
513025341
513025330
513025340
513025329
513025339
513025325
513025333
513025343
513025332
513025342
513025331
513025341
513025330
513025340
513025326
513025334
513025344
513025333
513025343
513025332
513025342
513025331
513025341
513025327
513025335
513025345
513025334
513025344
513025333
513025343
513025332
513025342
513025328
513025336
513025346
513025335
513025345
513025334
513025344
513025333
513025343
513025329
513025337
513025347
513025336
513025346
513025335
513025345
513025334
513025344
513025330
513025338
513025348
513025337
513025347
513025336
513025346
513025335
513025345
513025331
513025339
513025349
513025338
513025348
513025337
513025347
513025336
513025346
513025332
513025340
513025350
513025339
513025349
513025338
513025348
513025337
513025347
513025333
513025341
513025351
513025340
513025350
513025339
513025349
513025338
513025348
513025334
513025342
513025352
513025341
513025351
513025340
513025350
513025339
513025349
513025335
513025343
513025353
513025342
513025352
513025341
513025351
513025340
513025350
513025336
513025344
513025354
513025343
513025353
513025342
513025352
513025341
513025351
513025337
513025345
513025355
513025344
513025354
513025343
513025353
513025342
513025352
513025338
513025346
513025356
513025345
513025355
513025344
513025354
513025343
513025353
513025339
513025347
513025357
513025346
513025356
513025345
513025355
513025344
513025354
513025340
513025348
513025358
513025347
513025357
513025346
513025356
513025345
513025355
513025341
513025349
513025359
513025348
513025358
513025347
513025357
513025346
513025356
513025342
513025350
513025360
513025349
513025359
513025348
513025358
513025347
513025357
513025343
513025351
513025361
513025350
513025360
513025349
513025359
513025348
513025358
513025344
513025352
513025362
513025351
513025361
513025350
513025360
513025349
513025359
513025345
513025353
513025363
513025352
513025362
513025351
513025361
513025350
513025360
513025346
513025354
513025364
513025353
513025363
513025352
513025362
513025351
513025361
513025347
513025355
513025365
513025354
513025364
513025353
513025363
513025352
513025362
513025348
513025356
513025366
513025355
513025365
513025354
513025364
513025353
513025363
513025349
513025357
513025367
513025356
513025366
513025355
513025365
513025354
513025364
513025350
513025358
513025368
513025357
513025367
513025356
513025366
513025355
513025365
513025351
513025359
513025369
513025358
513025368
513025357
513025367
513025356
513025366
513025352
513025360
513025370
513025359
513025369
513025358
513025368
513025357
513025367
513025353
513025361
513025371
513025360
513025370
513025359
513025369
513025358
513025368
513025354
513025362
513025372
513025361
513025371
513025360
513025370
513025359
513025369
513025355
513025363
513025373
513025362
513025372
513025361
513025371
513025360
513025370
513025356
513025364
513025374
513025363
513025373
513025362
513025372
513025361
513025371
513025357
513025365
513025375
513025364
513025374
513025363
513025373
513025362
513025372
513025358
513025366
513025376
513025365
513025375
513025364
513025374
513025363
513025373
513025359
513025367
513025377
513025366
513025376
513025365
513025375
513025364
513025374
513025360
513025368
513025378
513025367
513025377
513025366
513025376
513025365
513025375
513025361
513025369
513025379
513025368
513025378
513025367
513025377
513025366
513025376
513025362
513025370
513025380
513025369
513025379
513025368
513025378
513025367
513025377
513025363
513025371
513025381
513025370
513025380
513025369
513025379
513025368
513025378
513025364
513025372
513025382
513025371
513025381
513025370
513025380
513025369
513025379
513025365
513025373
513025383
513025372
513025382
513025371
513025381
513025370
513025380
513025366
513025374
513025384
513025373
513025383
513025372
513025382
513025371
513025381
513025367
513025375
513025385
513025374
513025384
513025373
513025383
513025372
513025382
513025368
513025376
513025386
513025375
513025385
513025374
513025384
513025373
513025383
513025369
513025377
513025387
513025376
513025386
513025375
513025385
513025374
513025384
513025370
513025378
513025388
513025377
513025387
513025376
513025386
513025375
513025385
513025371
513025379
513025389
513025378
513025388
513025377
513025387
513025376
513025386
513025372
513025380
513025390
513025379
513025389
513025378
513025388
513025377
513025387
513025373
513025381
513025391
513025380
513025390
513025379
你可以看到,我不工作,我知道整个设计有缺陷,但我无法找到,我确实会感谢你的帮助。
a summary of the problem -
I have a diff list [8,18,7,17,6,16,5,15] the program starts with getting an id, each time I need to check the next id which is - id + diff[i] (i=0) if (id + diff[i]) isn t a valid id I m checking the next id which is (id + diff[i+1]).
如果该电离有效(id + diff[i.n]) I m id by 1, andeck if id+1 is valid id, if not I m eck re with id + diff[i.n], until I ll found the next valid id.
in each iteration I m checking ids I ve already checked in the previous iteration (which costs a lot of time and is inefficient), I need to avoid checking the IDs I ve already checked and keep increasing the ID until I ll find the next valid ID.
id= 1(且有效)和 d=[8,18,7,17,6,16,5,15]。
first iteration will look like (I m marking with bold the id s which I could avoid checking) - first - id = 1
9、19、8、18、7、17、6、16、2
二、背 景
www.un.org/Depts/DGACM/index_chinese.htm
第三类:id=3
http://www.un.org/Depts/DGACM/index_chinese.htm
第四编:id=4
<>12><22>>>>-BINGO, 下一个有效地址是22!
这给我提出了29项要求,而不是17项,而我只是一个小例子,其范围从最后有效补贴的300-600英亩。
我可以拿手法,避免以聪明和有效的方式检查以前检查过的婴儿。
感谢!