
Python
a771948524
My name is developer
展开
-
python实现百度、优快云、淘宝、人人自动登录(第一季)
社区账号太多,每家还要搞什么连续登陆天数,领积分啥的,经常不是忘记,就是没时间。正好在学习python,整网络爬虫,所以就尝试着写一个脚本,自动解决。新手的悲剧啊,摸索着前进,其中的艰辛无以言表啊。最后结果如下: 登陆 领积分百度空间: 成功 失败优快云转载 2013-05-07 21:41:45 · 2146 阅读 · 0 评论 -
Python读取天气预报
天气预报借口 http://blog.youkuaiyun.com/hello_haozi/article/details/7564223import urllib2import json# 101180101url = 'http://m.weather.com.cn/data/101180101.html're = urllib2.urlopen(url).read()re =原创 2013-09-28 20:02:49 · 1193 阅读 · 0 评论 -
OpenCV: realtime face detection in python
#!/usr/bin/python #----------------------------------------------------------------------------# Face Detection Test (OpenCV)## thanks to:# http://japskua.wordpress.com/2010/08/04/detecting-eyes转载 2013-08-20 09:54:48 · 1813 阅读 · 0 评论 -
python 从姐脱吧下载妹子图片
http://www.oschina.net/code/snippet_1026739_23103我看好多人写着玩,下载下来没执行成功(我没看代码不知原因),然后自己写个玩玩 -_#请自行在代码目录下 创建 teba文件夹。。当然了 口味重的 可以把 贴吧地址 改成 LES 吧 或者 同志吧 之类的#!/usr/bin/env python# -*- coding:u转载 2013-08-06 18:00:29 · 5684 阅读 · 0 评论 -
[Python] 控制台输入密码的方法
1. raw_input() :转载 2013-07-05 09:12:12 · 1571 阅读 · 0 评论 -
《编程之美》2.10 寻找数组中的最大值和最小值
扩展问题自己想的,还没有搜索有没有其它解法...发现这节就是算法导论9.1嘛... 1. [代码]解法一,只会这种估计要被淘汰的... 跳至 [1] [2] [3] [4] [5] [全屏预览] #--coding: utf8 --def find_max_and_min(A): min = max = A[0] for i in range(1转载 2013-06-04 08:19:58 · 1170 阅读 · 0 评论 -
python 二分查找
自己随意写的是递归的方法,后来查到下面的代码用的非递归的,都差不多意思啦,练习一下...http://www.oschina.net/code/snippet_250815_10547在其它语言中,如果low + high的和大于Integer的最大值,比如2 ** 31 - 1,计算便会发生溢出,使它成为一个负数,然后被2除时结果仍为负数。在Java语言中,这个Bug导致转载 2013-05-31 12:07:20 · 1185 阅读 · 0 评论 -
python 登陆126 类型装换 求素数 分割字符串shlex方法
登陆126邮箱:import timefrom splinter import Browserdef splinter(url): browser = Browser() browser.visit(url) time.sleep(5) browser.find_by_id('idInput').fill('******') browser.f原创 2013-05-27 15:15:59 · 1277 阅读 · 0 评论 -
python 文件批量剪切
import osfrom PIL import Image#批量剪切目录下图片for j in range(10,121): p = 'C:/'+str(j)+'/' #图片目录 # print p a = os.listdir(p) for i in a: path = p+i print原创 2013-05-25 19:54:50 · 2311 阅读 · 0 评论 -
Python socket 编程
server.py# -*- coding: cp936 -*-#file:tcpserver.pyimport socketfrom time import ctimeimport sysbufsize = 1024host = '127.0.0.1'port = 8100address = (host,port)server_sock = socket.socket原创 2013-05-27 13:41:35 · 1213 阅读 · 0 评论 -
PYTHON笔记
PYTHON笔记# 注释\ 下行继续; 逻辑换行1. If (条件) : (语句) elif(条件) : (语句)else: (语句)PS: PTTHON是靠缩进来判断层次的,所以缩进很重要2. For:…in…else:For i in range(1,5)Print I;Else:Print ‘the for loop is over’转载 2013-05-08 21:00:18 · 1043 阅读 · 0 评论 -
python 图片截取
先安安装PyGraphics包 (python import media模块)有一段代码要import media,打开python自带的IDLE,输入:>>>import media就会提示没有media这个模块!原来media模块不是系统的标准模块,需要安装第三方软件后才能用。这个库是在PyGraphics里,不过PyGraphics依赖一些别的库。原创 2013-05-26 15:13:08 · 2654 阅读 · 0 评论 -
【整理】Python中,添加写入数据到已经存在的Excel的xls文件,即打开excel文件,写入新数据
//////////////////写入方法一: import xlwt;import xlrd;#import xlutils;from xlutils.copy import copy; #init xls file#styleBlueBkg= xlwt.easyxf('pattern: pattern solid, fore_colour sky_转载 2013-05-25 20:40:16 · 3889 阅读 · 0 评论 -
Python的Excel接口 xlrd
使用 xlrd 能够很方便的读取 excel 文件内容, 而且这是个跨平台的库,能够在windows,linux/unix,等平台上面使用。示例代码:import xlrd fname = "sample.xls"bk = xlrd.open_workbook(fname)shxrange = range(bk.nsheets)try: sh = bk.she转载 2013-05-25 20:04:53 · 2207 阅读 · 0 评论 -
python 读取 excel 的方法封装
今天需要从一个Excel文档(.xls)中导数据到数据库的某表,开始是手工一行行输的。后来想不能一直这样,就用Python写了下面的代码,可以很方便应对这种场景。比如利用我封装的这些方法可以很方便地生成导入数据的SQL。 当然熟悉Excel编程的同学还可以直接用VBA写个脚本生成插入数据的SQL。 还可以将.xls文件改为.csv文件,然后通过SQLyog或者Navicat等工具导入进来,转载 2013-05-25 20:00:02 · 1773 阅读 · 0 评论 -
hello python!
hello python!在编写钱首先下载python程序! 软件下载请到官方网站www.python.org 下载选择download 选择适合你的应用平台 (大多是windows的用户所以选windows项现在)运行主程序:IDLE(Python GUI)然后直接在命令行中 输入 :print "hello python!"就可已显示出一个helloworld!原创 2012-11-09 22:49:29 · 916 阅读 · 0 评论 -
小试一下 python写的简单DOS框聊天脚本
import threadingimport datetimeimport socketotherip='192.168.3.29'otherport=8003yourport=8003class ServerClass(threading.Thread):def run(self):print '1start'if __name__ == '__main__'转载 2013-05-08 20:58:34 · 1503 阅读 · 0 评论 -
用Python抓网页上的图片
# -*- coding: utf-8 -*-"""some function by metaphy,2014-04-03,copyleftversion 0.2"""import urllib, httplib, urlparseimport reimport random"""judge url exists or not,by others"""def httpExist原创 2014-04-07 10:09:37 · 935 阅读 · 0 评论