随笔分类 - 小模块
摘要:# coding:utf-8 def exchange_mask(mask): """ 转换子网掩码格式 """ # 计算二进制字符串中 '1' 的个数 count_bit = lambda bin_str: len([i for i in bin_str if i=='1']) # 分割字符串格式
阅读全文
摘要:#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
阅读全文
摘要:#coding=utf-8 from IPy import IP write=open('result.txt','a') allgame=open('allgame.txt') gameline=allgame.readline() while gameline: name=gameline.sp
阅读全文
摘要: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
阅读全文
摘要:#coding=utf-8 import re import subprocess def tracertIP(ip): p = subprocess.Popen(['tracert',ip],stdout=subprocess.PIPE) while True: line = p.stdout.r
阅读全文
摘要:#coding=utf-8import sysimport os import re import urllibimport subprocess def getlocation(ip): result = urllib.urlopen("http://www.ip138.com/ips.asp?i
阅读全文
摘要:#coding=utf-8# -*- coding: utf-8 -*-import osimport sysreload(sys) sys.setdefaultencoding('utf-8') def GetFileList(dir, fileList): newDir = dir if os.
阅读全文
摘要:#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
阅读全文

浙公网安备 33010602011771号