Python教程
Python是一种面向对象的解释型...
-
python爬虫-爬取代理IP并通过多线程快速验证 python">mport urllib2 from BeautifulSoup import BeautifulSoup # get the proxy of = open('proxy.txt', 'w') for page in range(1,50): url = 'http://www.xicidaili.com/... 继续阅读python爬虫-爬取代理IP并通过多线程快速验证
:2018-05-17
-
python编写的一个通过多线程扫描端口的代码 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: ... 继续阅读python编写的一个通过多线程扫描端口的代码
:2018-05-17
-
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 file... 继续阅读python 删除指定格式的文件
:2018-05-17
-
Python连接Oracle python 3.4.3 cx_Oracle“` python !/usr/bin/env python import time start = time.clock() import cx_Oracle tns = cx_Oracle.makedsn(‘127.0.0.1’, ‘1534’, ‘dsn’) db = cx_Oracle.connect(‘user... 继续阅读Python连接Oracle
:2018-05-17
-
python 利用python 统计源码行数 原理先获取所有文件,然后统计每个文件中代码的行数,最后将行数相加,思路很简单。“`python import os import os.path import time rootdir = ‘文件路径’ filelists = [] 遍历文件 def getFile(rootdir): global filelists for parent,dir... 继续阅读python 利用python 统计源码行数
:2018-05-17
-
python 演示异常 python">#coding=utf-8 #异常用法 import sys #---------------- #sys.exc_info()[2].tb_lineno值不是固定的 try: x=1/0 except Exception as e: print "Exception:[%s][%s]" % (sys.exc_info()[2]... 继续阅读python 演示异常
:2018-05-17
-
python 用python 写了一个求空间俩点之间的距离的脚本 python">import math L1=['104','32','249','177'] L2=['191','538','317','795'] L3=['735','346','542','429'] L4=['434','277','659','132'] L5=['866','569','46','763']... 继续阅读python 用python 写了一个求空间俩点之间的距离的脚本
:2018-05-17
-
python初学之helloworld python">''' print the "Hello, world!" on the console ''' import os ''' read data in file ''' class File: def __init__(self): self.data = os.getcwd()+'\\data.txt... 继续阅读python初学之helloworld
:2018-05-17
-
Python实现的哈夫曼编码 python">#coding:utf-8 import struct codeDict={}#全局字典key=字符,value=数字 encodeDict={} filename=None listForEveryByte=[] class Node: def __init__(self,right=None,left=None,parent=N... 继续阅读Python实现的哈夫曼编码
:2018-05-17
-
python common iter query python">def iquery(conn, sql, rowfactory=tuple, batch=1, *args, **kwgs): """在给定的数据库连接conn上执行sql(可带有参数*args或命名参数**kwgs) rowfactory指定输出物为元组/字典(或字典的扩展类) /或使用... 继续阅读python common iter query
:2018-05-17