Python教程
Python教程:包含了所有代写案例以及部分答案
-
#!/usr/bin/python """ 2015.07.02 Clean all the genrated files during compile. Edited by Grey """ import os,re def CleanAll(file_ext): # remove all files in bin for root,dirs,files in os.walk(‘./bin’): for each_file in fi … 继续阅读“python 删除指定格式的文件”
:
-
#!/usr/bin/env python import socket import sys import threading import time NORMAL = 0 ERROR = 1 TIMEOUT = 5 def ping(ip , port , timeout=TIMEOUT): try: cs=socket.socket(socket.AF_INET,socket.SOCK_STREAM) cs.settimeout(float(timeout)) address=(str(ip … 继续阅读“python编写的一个通过多线程扫描端口的代码”
:
-
class JianKong(): ”’查询IDC信息,封ip和过白名单”’ def __init__(self): pass @classmethod def ip_verify(cls,str): ‘验证IP地址规范’ pattern=re.compile(‘(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1 … 继续阅读“python 匹配IP和匹配域名”
:
-
文件型数据库sqllite读写操作:“`python None MySQL数据库读写操作:“`python def ExecSql(sql, dbName="", host="", user="", passwd="", charset=”): import MySQLdb conn = MySQLdb.connect(host=host, user=user, passwd=passwd, char … 继续阅读“Python数据库操作”
:
-
”’ pg_midi_sound101.py play midi music files (also mp3 files) using pygame tested with Python273/331 and pygame192 by vegaseat ”’ import pygame as pg def play_music(music_file): ”’ stream music with mixer.music module in blocking manner this will … 继续阅读“python通过PyGame播放Midi和Mp3文件”
:
-
import ssl import json from PIL import Image import urllib import re import urllib.request as urllib2 if hasattr(ssl, ‘_create_unverified_context’): ssl.create_default_context = ssl._create_unverified_context UA = "Mozilla/5.0 (Macintosh; Intel … 继续阅读“Python3.4实现的12306最新验证码识别”
:
-
#!/usr/bin/env python # encoding:utf-8 from socket import * from ctypes import create_string_buffer from struct import * import sysconfig import random from ctypes.wintypes import BYTE from msilib import datasizemask from _ctypes import sizeof from r … 继续阅读“python 模拟登录封包python实现”
: