随笔分类 -  小模块

摘要:# coding:utf-8 def exchange_mask(mask): """ 转换子网掩码格式 """ # 计算二进制字符串中 '1' 的个数 count_bit = lambda bin_str: len([i for i in bin_str if i=='1']) # 分割字符串格式 阅读全文
posted @ 2017-07-13 09:21 monster_ygs 阅读(1744) 评论(0) 推荐(0)
摘要:#coding=utf-8 Result=open('result.txt',"w") FileTunnel = open('tunnel.txt').readlines() New_dict = {} UpSum=0 DownSum=0 #NumBer=0 #计数次数 for Line in Fi 阅读全文
posted @ 2017-05-27 17:58 monster_ygs 阅读(224) 评论(0) 推荐(0)
摘要:#coding=utf-8 from IPy import IP write=open('result.txt','a') allgame=open('allgame.txt') gameline=allgame.readline() while gameline: name=gameline.sp 阅读全文
posted @ 2017-04-12 17:04 monster_ygs 阅读(326) 评论(2) 推荐(0)
摘要:def count(i): for k in range(1, 100+1): text.insert(END,'第'+str(i)+'线程count: '+str(k)+'\n') time.sleep(0.001) def fun(): for i in range(1, 5+1): th=th 阅读全文
posted @ 2017-03-20 23:53 monster_ygs 阅读(263) 评论(1) 推荐(0)
摘要:#coding=utf-8 import re import subprocess def tracertIP(ip): p = subprocess.Popen(['tracert',ip],stdout=subprocess.PIPE) while True: line = p.stdout.r 阅读全文
posted @ 2017-03-18 00:29 monster_ygs 阅读(1316) 评论(0) 推荐(0)
摘要:#coding=utf-8import sysimport os import re import urllibimport subprocess def getlocation(ip): result = urllib.urlopen("http://www.ip138.com/ips.asp?i 阅读全文
posted @ 2017-03-18 00:16 monster_ygs 阅读(332) 评论(0) 推荐(0)
摘要:#coding=utf-8# -*- coding: utf-8 -*-import osimport sysreload(sys) sys.setdefaultencoding('utf-8') def GetFileList(dir, fileList): newDir = dir if os. 阅读全文
posted @ 2017-03-16 22:57 monster_ygs 阅读(15549) 评论(0) 推荐(0)
摘要:#coding=utf-8import urllib2import re print re.search('\d+\.\d+\.\d+\.\d+',urllib2.urlopen("http://www.ip138.com/ip2city.asp").read()).group(0) re.sear 阅读全文
posted @ 2017-03-16 22:38 monster_ygs 阅读(431) 评论(0) 推荐(0)