-
利用手机远程控制电脑干坏事
所属栏目:[Python] 日期:2020-12-17 热度:193
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #coding=UTF-8import poplibimport reimport stringimport timefrom subprocess import Popenfrom subprocess import PIPEimport win32apiimport win3[详细]
-
自动识别现接serial端口名称
所属栏目:[Python] 日期:2020-12-17 热度:108
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/env python# -*- coding: utf-8 -*import serialimport serial.tools.list_portsport_list = list(serial.tools.list_ports.comports())if[详细]
-
任意生身份证号码(最新区域划分)
所属栏目:[Python] 日期:2020-12-17 热度:125
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import http.cookiejarimport urllib.requestimport urllib.parsefrom PIL import Imageimport gzip,re,randomclass Crawler_self: def __init__(self[详细]
-
python根据域名获得ip地址
所属栏目:[Python] 日期:2020-12-17 热度:113
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 def getIp(domain): import socket myaddr = socket.getaddrinfo(domain,'http')[0][4][0] print(myaddr) 其中domain为域名,如?www.sharejs.com,不[详细]
-
python提取url中的域名和端口号
所属栏目:[Python] 日期:2020-12-17 热度:141
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import urllib proto,rest = urllib.splittype("http://www.open-open.com/") host,rest = urllib.splithost(rest) print host host,port = urllib.sp[详细]
-
python编写的用于测试网站访问速率的代码片段
所属栏目:[Python] 日期:2020-12-17 热度:141
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 python编写的用于测试网站访问速率的代码片段,可以输出打开某url的时间,访问100次的平均时间,最大时间和最小时间等等 def Process(url,n): minSpan[详细]
-
python(PIL)图像处理(等比例压缩、裁剪压缩) 缩略(水印)图
所属栏目:[Python] 日期:2020-12-17 热度:154
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #coding:utf-8''' python图片处理 @author:fc_lamp @blog:http://fc-lamp.blog.163.com/'''import Image as image#等比例压缩图片def resizeImg(**arg[详细]
-
用Python实现二分查找
所属栏目:[Python] 日期:2020-12-17 热度:52
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/env pythonimport sys def search2(a,m): low = 0 high = len(a) - 1 while(low = high): mid = (low + high)/2 midval = a[mid] if midva[详细]
-
python正则表达式提取网页URL
所属栏目:[Python] 日期:2020-12-17 热度:136
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import reimport urlliburl="http://www.open-open.com"s=urllib.urlopen(url).read()ss=s.replace(" ","")urls=re.findall(r"a.*?href=.*?/a",ss,re[详细]
-
Windows下Python获取磁盘空闲空间并写入日志
所属栏目:[Python] 日期:2020-12-17 热度:179
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 from ctypes import *import timeimport win32file run = Truelogfile = open('.log.out','w+');#open log fileinput = raw_input("Input a string[详细]
-
python提取页面内的url列表
所属栏目:[Python] 日期:2020-12-17 热度:170
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 from bs4 import BeautifulSoupimport time,re,urllib2 t=time.time() websiteurls={} def scanpage(url): websiteurl=url t=time.time() n=0 html=ur[详细]
-
python删除源文件中的注释并编译
所属栏目:[Python] 日期:2020-12-17 热度:177
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/bin/env python# -*- coding:utf-8 -*-# -------------------------------# Filename: # Revision:# Date: 2012-12-3# Author: simonzhang# Email:[详细]
-
python统计文本字符串里面单词出现的频率
所属栏目:[Python] 日期:2020-12-17 热度:120
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 python统计文本字符串里面单词出现的频率 # word frequency in a text# tested with Python24 vegaseat 25aug2005 # Chinese wisdom ...str1 = """Man[详细]
-
下载壁纸
所属栏目:[Python] 日期:2020-12-17 热度:184
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 ?import reimport osimport urllib.requesthome = "http://www.gamersky.com/ent/wp/"i_count = 5 # 爬取的列表数量def downImg(url,title): if not o[详细]
-
使用递归方法分解Python中多重嵌套列表
所属栏目:[Python] 日期:2020-12-17 热度:116
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #Welcome to My blog#www.suzhengpeng.comdef listPrint(listName): for fstItem in listName: if isinstance (fstItem,list): listPrint(fstItem) el[详细]
-
python十进制转二进制,可指定位数
所属栏目:[Python] 日期:2020-12-17 热度:56
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 python十进制转二进制,可指定位数 # convert a decimal (denary,base 10) integer to a binary string (base 2)# tested with Python24 vegaseat 6/1[详细]
-
wxpython GUI界面显示jpg图片
所属栏目:[Python] 日期:2020-12-17 热度:173
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 # show a jpeg (.jpg) image using wxPython,newer coding style# two different ways to load and display are given# tested with Python24 and wxP[详细]
-
python显示生日是星期几
所属栏目:[Python] 日期:2020-12-17 热度:183
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 # find the day of the week of a given date# Python will trap impossible dates like (1900,2,29)# tested with Python24 vegaseat 01aug2005 from[详细]
-
python zip和unzip数据
所属栏目:[Python] 日期:2020-12-17 热度:147
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 # zipping and unzipping a string using the zlib module# a very large string could be zipped and saved to a file speeding up file writing tim[详细]
-
通过python自动连接ssh服务器
所属栏目:[Python] 日期:2020-12-17 热度:87
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/python #-*- coding:utf-8 -*- import sys,time,os try: import pexpectexcept ImportError: print """ You must install pexpect module[详细]
-
用python做的另外一种实现的二分查找
所属栏目:[Python] 日期:2020-12-17 热度:62
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 arr = [1,2,3,4,5,6,7,8,9,10];def search(someone,arr): l = -1; h = len(arr); while l + 1 != h: m = int((l + h) / 2); if arr[m] someone: l = m[详细]
-
python递归删除指定目录
所属栏目:[Python] 日期:2020-12-17 热度:188
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 '''@author: Administrator'''#coding=utf-8import osimport shutildir = "G://tmp//sz//ngtsverify" def removeDir(): for root,dirs,files in os.wa[详细]
-
wxpython开发的简单的gui计算器
所属栏目:[Python] 日期:2020-12-17 热度:91
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 # wxCalc1 a simple GUI calculator using wxPython# created with the Boa Constructor which generates all the GUI components# all I had to do i[详细]
-
python删除整个目录(目录非空)
所属栏目:[Python] 日期:2020-12-17 热度:114
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import osimport shutil def CleanDir( Dir ): if os.path.isdir( Dir ): paths = os.listdir( Dir ) for path in paths: filePath = os.path.join( D[详细]
-
python通过win32com库播放mp3文件
所属栏目:[Python] 日期:2020-12-17 热度:125
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 # Python supports COM,if you have the Win32 extensions# check your Python folder eg. D:Python23Libsite-packageswin32com# also http://sta[详细]
