文章詳情頁
python - 多線程小白求問這樣的IP要怎么實(shí)現(xiàn)多線程print?
瀏覽:104日期:2022-06-30 08:16:42
問題描述
def hanshu(b): print(b)a='192.168.1.1-3'for ip in a.split(’,’): if ’-’ in ip:s1, s2 = ip.rsplit(’.’, 1)start, end = map(int, s2.split(’-’))for num in range(start, end+1): b=s1+’.’+str(num) hanshu(b) else:hanshu(ip)
問題解答
回答1:https://pypi.python.org/pypi/IPy/
使用這個(gè)模塊,你的代碼不會(huì)這么難看,而且split(',') 寫錯(cuò)了
回答2:多線程要用的threading模塊吧,不是很明白你要什么
相關(guān)文章:
1. MySQL客戶端吃掉了SQL注解?2. php自學(xué)從哪里開始?3. mysql - AttributeError: ’module’ object has no attribute ’MatchType’4. 數(shù)據(jù)庫 - MySQL 單表500W+數(shù)據(jù),查詢超時(shí),如何優(yōu)化呢?5. 求大神幫我看看是哪里寫錯(cuò)了 感謝細(xì)心解答6. python - Django分頁和查詢參數(shù)的問題7. javascript - 圖片能在網(wǎng)站顯示,但控制臺(tái)仍舊報(bào)錯(cuò)403 (Forbidden)8. javascript - 百度echarts series數(shù)據(jù)更新問題9. phpstady在win10上運(yùn)行10. python小白的基礎(chǔ)問題 關(guān)于while循環(huán)的嵌套
排行榜

熱門標(biāo)簽