代码
import requests
url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing={}"
def gethtml(index):
response = requests.get(url.format(index))
return response
index = 12345
count=1
while True:
try:
req = gethtml(index)
source = req.text
num = source.split(' ')[-1]
if 'html' in source or 'php' in source:
print(f"第{count}次访问后找到结果:", source)
break
else:
index = num
print(f"第{count}次访问:",source)
except:
print("出错了", index)
count+=1
结果:
and the next nothing is 44827
and the next nothing is 45439
<font color=red>Your hands are getting tired </font>and the next nothing is 94485
and the next nothing is 72198
and the next nothing is 80992
and the next nothing is 8880
and the next nothing is 40961
and the next nothing is 58765
and the next nothing is 46561
and the next nothing is 13418
and the next nothing is 41954
and the next nothing is 46782
and the next nothing is 92730
and the next nothing is 89229
and the next nothing is 25646
and the next nothing is 74288
and the next nothing is 25945
and the next nothing is 39876
and the next nothing is 8498
and the next nothing is 34684
and the next nothing is 62316
and the next nothing is 71331
and the next nothing is 59717
and the next nothing is 76893
and the next nothing is 44091
and the next nothing is 73241
and the next nothing is 19242
and the next nothing is 17476
and the next nothing is 39566
and the next nothing is 81293
and the next nothing is 25857
and the next nothing is 74343
and the next nothing is 39410
and the next nothing is 5505
and the next nothing is 27104
and the next nothing is 54003
and the next nothing is 23501
and the next nothing is 21110
and the next nothing is 88399
and the next nothing is 49740
and the next nothing is 31552
and the next nothing is 39998
and the next nothing is 19755
and the next nothing is 64624
and the next nothing is 37817
and the next nothing is 43427
and the next nothing is 15115
and the next nothing is 44327
and the next nothing is 7715
and the next nothing is 15248
and the next nothing is 61895
and the next nothing is 54759
and the next nothing is 54270
and the next nothing is 51332
and the next nothing is 63481
and the next nothing is 12362
and the next nothing is 94476
and the next nothing is 87810
and the next nothing is 6027
and the next nothing is 47551
and the next nothing is 79498
and the next nothing is 81226
and the next nothing is 4256
and the next nothing is 62734
and the next nothing is 25666
and the next nothing is 14781
and the next nothing is 21412
and the next nothing is 55205
and the next nothing is 65516
and the next nothing is 53535
and the next nothing is 4437
and the next nothing is 43442
and the next nothing is 91308
and the next nothing is 1312
and the next nothing is 36268
and the next nothing is 34289
and the next nothing is 46384
and the next nothing is 18097
and the next nothing is 9401
and the next nothing is 54249
and the next nothing is 29247
and the next nothing is 13115
and the next nothing is 23053
and the next nothing is 3875
and the next nothing is 16044
Yes. Divide by two and keep going.
and the next nothing is 72758
and the next nothing is 71301
and the next nothing is 55577
and the next nothing is 88786
and the next nothing is 32293
and the next nothing is 87798
and the next nothing is 24838
and the next nothing is 66137
and the next nothing is 88016
and the next nothing is 36876
and the next nothing is 33179
and the next nothing is 90231
and the next nothing is 17825
and the next nothing is 84361
and the next nothing is 99222
and the next nothing is 87348
and the next nothing is 47100
and the next nothing is 90650
and the next nothing is 84369
and the next nothing is 36116
and the next nothing is 96544
and the next nothing is 62892
and the next nothing is 43790
and the next nothing is 67652
and the next nothing is 32839
and the next nothing is 5353
and the next nothing is 63153
and the next nothing is 48029
and the next nothing is 84141
and the next nothing is 14662
and the next nothing is 78566
and the next nothing is 18131
and the next nothing is 710
and the next nothing is 67500
and the next nothing is 34992
and the next nothing is 64568
and the next nothing is 8155
and the next nothing is 30579
and the next nothing is 11629
and the next nothing is 32490
and the next nothing is 47936
and the next nothing is 51350
and the next nothing is 51877
and the next nothing is 38270
and the next nothing is 41643
and the next nothing is 23416
and the next nothing is 54432
and the next nothing is 4448
and the next nothing is 30086
and the next nothing is 93346
and the next nothing is 53491
and the next nothing is 31248
and the next nothing is 37446
and the next nothing is 11309
and the next nothing is 13878
and the next nothing is 31404
and the next nothing is 27786
and the next nothing is 16030
and the next nothing is 4689
and the next nothing is 16553
and the next nothing is 98150
and the next nothing is 19224
and the next nothing is 71919
and the next nothing is 53068
and the next nothing is 71407
and the next nothing is 54264
and the next nothing is 33407
and the next nothing is 11086
and the next nothing is 72527
and the next nothing is 92923
and the next nothing is 93389
and the next nothing is 94438
and the next nothing is 88796
and the next nothing is 90785
and the next nothing is 73079
and the next nothing is 75559
and the next nothing is 53223
and the next nothing is 75979
and the next nothing is 55749
and the next nothing is 52948
and the next nothing is 71569
and the next nothing is 10240
and the next nothing is 3064
and the next nothing is 29818
and the next nothing is 88835
and the next nothing is 38200
and the next nothing is 32515
and the next nothing is 43551
and the next nothing is 1398
and the next nothing is 23580
and the next nothing is 31619
and the next nothing is 83052
and the next nothing is 37409
and the next nothing is 85052
and the next nothing is 13510
and the next nothing is 43240
and the next nothing is 5868
and the next nothing is 19337
and the next nothing is 21122
and the next nothing is 92118
and the next nothing is 44659
and the next nothing is 60291
and the next nothing is 29895
and the next nothing is 98452
and the next nothing is 42243
and the next nothing is 25755
and the next nothing is 28879
and the next nothing is 37149
and the next nothing is 17033
and the next nothing is 543
and the next nothing is 82304
and the next nothing is 80616
and the next nothing is 36217
and the next nothing is 16201
and the next nothing is 33304
and the next nothing is 20091
and the next nothing is 93295
and the next nothing is 75485
and the next nothing is 1765
and the next nothing is 76626
and the next nothing is 92820
and the next nothing is 52222
and the next nothing is 2892
and the next nothing is 65776
and the next nothing is 817
and the next nothing is 2025
and the next nothing is 94455
and the next nothing is 47579
and the next nothing is 56908
and the next nothing is 39768
and the next nothing is 76810
and the next nothing is 36875
and the next nothing is 97644
and the next nothing is 84602
and the next nothing is 86446
and the next nothing is 71359
and the next nothing is 33883
and the next nothing is 70553
and the next nothing is 98832
and the next nothing is 60599
and the next nothing is 17342
and the next nothing is 74423
and the next nothing is 41609
and the next nothing is 54377
and the next nothing is 33490
and the next nothing is 35815
and the next nothing is 59166
and the next nothing is 11441
and the next nothing is 94796
and the next nothing is 68509
and the next nothing is 45872
and the next nothing is 81664
and the next nothing is 94537
and the next nothing is 36571
and the next nothing is 52815
and the next nothing is 54533
and the next nothing is 74595
and the next nothing is 55654
and the next nothing is 48550
and the next nothing is 56044
and the next nothing is 25536
and the next nothing is 30479
and the next nothing is 77512
and the next nothing is 94866
and the next nothing is 26746
and the next nothing is 44833
and the next nothing is 96169
and the next nothing is 73807
and the next nothing is 65481
and the next nothing is 28520
and the next nothing is 71069
and the next nothing is 40951
and the next nothing is 72828
and the next nothing is 80158
and the next nothing is 22504
and the next nothing is 69881
and the next nothing is 15695
and the next nothing is 49718
and the next nothing is 64436
and the next nothing is 27671
and the next nothing is 44306
and the next nothing is 59668
and the next nothing is 52257
and the next nothing is 7219
and the next nothing is 36882
and the next nothing is 48246
and the next nothing is 10907
and the next nothing is 57291
and the next nothing is 15565
and the next nothing is 40253
and the next nothing is 57887
and the next nothing is 75107
and the next nothing is 4757
and the next nothing is 3219
and the next nothing is 84631
and the next nothing is 75550
and the next nothing is 30793
and the next nothing is 30982
and the next nothing is 4391
and the next nothing is 86607
and the next nothing is 41433
and the next nothing is 97107
and the next nothing is 89858
and the next nothing is 186
and the next nothing is 37842
and the next nothing is 2777
and the next nothing is 44508
and the next nothing is 48314
and the next nothing is 48355
and the next nothing is 67280
and the next nothing is 852
and the next nothing is 6756
and the next nothing is 93964
and the next nothing is 51422
and the next nothing is 82972
and the next nothing is 20192
and the next nothing is 12568
and the next nothing is 33780
and the next nothing is 28995
and the next nothing is 94122
and the next nothing is 13677
and the next nothing is 78020
and the next nothing is 50718
and the next nothing is 3014
and the next nothing is 87513
and the next nothing is 60592
and the next nothing is 16613
and the next nothing is 48784
and the next nothing is 91727
and the next nothing is 81823
and the next nothing is 92306
and the next nothing is 82052
and the next nothing is 99401
and the next nothing is 2228
and the next nothing is 69304
and the next nothing is 36845
and the next nothing is 72224
and the next nothing is 84132
and the next nothing is 92376
and the next nothing is 40503
and the next nothing is 67329
and the next nothing is 56881
and the next nothing is 72156
and the next nothing is 46463
and the next nothing is 62058
and the next nothing is 54696
and the next nothing is 65731
and the next nothing is 38290
and the next nothing is 57913
and the next nothing is 6309
and the next nothing is 73902
and the next nothing is 19934
and the next nothing is 16055
and the next nothing is 50563
and the next nothing is 47825
and the next nothing is 73265
and the next nothing is 90961
and the next nothing is 29740
and the next nothing is 43628
and the next nothing is 11088
and the next nothing is 93781
and the next nothing is 55840
and the next nothing is 80842
and the next nothing is 59022
and the next nothing is 23298
and the next nothing is 27709
and the next nothing is 96791
and the next nothing is 75635
and the next nothing is 52899
and the next nothing is 66831
peak.html
and the next nothing is 72758
and the next nothing is 71301
and the next nothing is 55577
and the next nothing is 88786
and the next nothing is 32293
and the next nothing is 87798
and the next nothing is 24838
and the next nothing is 66137
and the next nothing is 88016
and the next nothing is 36876
and the next nothing is 33179
and the next nothing is 90231
and the next nothing is 17825
and the next nothing is 84361
and the next nothing is 99222
and the next nothing is 87348
and the next nothing is 47100