您的位置:首頁/技術文章
文章詳情頁

python - 多線程小白求問這樣的IP要怎么實現多線程print?

瀏覽:99日期: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/

使用這個模塊,你的代碼不會這么難看,而且split(',') 寫錯了

回答2:

多線程要用的threading模塊吧,不是很明白你要什么

標簽: Python 編程
相關文章:
国产综合久久一区二区三区