Python教程
Python教程:包含了所有代写案例以及部分答案
-
这是一个简单的网络程序,可以用来扫描指定ip的常用端口 from socket import * tgtHost=raw_input("What is the web address?: ") tgtPorts=raw_input("What are the ports seperated by commas? or would you like to test all?: ") def connScan(tgtHost, tgtPort): try: c … 继续阅读“python端口扫描程序”
:
-
""" python汉字随机组合.py 依山居 7:07 2015/11/11 相关资料 Python random模块 http://my.oschina.net/cuffica/blog/33336 题目来源: http://www.bathome.net/viewthread.php?tid=37773 """ import time import random start=time.time() s="圣诚杰安博彬宝斌 … 继续阅读“python汉字随机组合.py”
:
-
# -*- coding:utf-8 -*- __author__ = ‘Barry’ from PIL import Image from PIL.ExifTags import TAGS from datetime import datetime from hashlib import md5 import time import os import shutil import fnmatch import random def IterFindFiles(path, fnexp): for … 继续阅读“python 按日期对照片进行分类整理”
:
-
#B tree class TreeNode: def __init__(self,x): self.val=x self.left=None self.right=None def builtTree(): root=None val=input("Enter the value:") if(val==’#’): pass else: root=TreeNode(val) root.left=builtTree() root.right=builtTree() return … 继续阅读“python 二叉树遍历”
:
-
# -*- coding: cp936 -*- import urllib2 import urllib def postHttp(name=None,tel=None,address=None, price=None,num=None,paytype=None, posttype=None,other=None): url="http://www.xxx.com/dog.php" #定义要提交的数据 postdata=dict(name=name,tel=tel,addre … 继续阅读“python 通过python post提交数据的代码演示”
:
-
#coding:utf-8 #author:Elvis class TreeNode(object): def __init__(self): self.data = ‘#’ self.l_child = None self.r_child = None class Tree(TreeNode): #create a tree def create_tree(self, tree): data = raw_input(‘->’) if data == ‘#’: tree = None el … 继续阅读“python实现二叉树的创建和遍历”
:
-
import libvirt import os import uuid try: from PIL import Image print("PIL") except ImportError: import Image def handler(stream, buf, opaque): fd = opaque os.write(fd, buf) THUMBNAIL_SIZE =(256, 256) thumbnail = ‘/home/hcc/test/screenshot/ … 继续阅读“python 使用libvirt抓取linux kvm虚拟机的缩略图”
:
-
#!/usr/bin/env python # -*- coding:utf-8 -*- import os,re def main(): fileList=os.listdir(os.getcwd()) p=re.compile(‘\[.*\]’) for fileName in fileList: print(fileName) if ‘[‘ in fileName: os.rename(fileName,p.sub(”,fileName)) #用正则表达式的结果重命名 if fileNa … 继续阅读“python 去掉当前目录下电影名字前的框框”
:
-
# -*- coding:utf-8 -*- class BinDecimal: def printBin(self, num): aa = num*2 rest = [] rest.append(str(int(aa))) while aa != 1: aa = (aa – int(aa))*2 rest.append(str(int(aa))) res = ‘0.’ + "".join(rest) if len(res)>= 32: return "Err … 继续阅读“python 二进制小数”
:
-
抓取超级课程表话题数据。 博文:http://my.oschina.net/jhao104/blog/606922“` python !/usr/local/bin/python2.7 –– coding: utf8 –– “”” 超级课程表话题抓取 “”” import urllib2 from cookielib import CookieJar import … 继续阅读“Python爬虫-抓取手机APP数据”
: