限制搜索(python)

限制搜索(python)

问题描述:

from shodan import WebAPI 

SHODAN_API_KEY = "MY API KEY" 
api = WebAPI(SHODAN_API_KEY) 

results = api.exploitdb.search('PHP') 

print 'Results found: %s' % results['total'] 
for exploit in results['matches']: 
     print '%s:' % (exploit['description']) 

如何限制搜索以仅打印前5个结果?限制搜索(python)

for exploit in results['matches'][:5]: 
     print '%s:' % (exploit['description']) 

把你的时间,了解列出了Python的基本知识,特别是 “切片”:

http://diveintopython.ep.io/native-datatypes.html