没得事就爬一下我喜欢的海贼王上的图片
需要在d盘下建立一个imgcache文件夹
# -*- coding: utf-8 -*-
import urllib
import urllib2
import json
from bs4 import BeautifulSoup
import threadpool
import thread
class htmlpaser:
de...
分类:
编程语言 时间:
2014-06-29 07:15:05
阅读次数:
304
题目:
Roman numerals come from the ancient Roman numbering system. They are based on specific letters of the alphabet which are combined to signify the sum (or, in some cases, the difference) of th...
分类:
其他好文 时间:
2014-06-20 12:27:09
阅读次数:
394
Python的多线程有两种实现方法:
函数,线程类
1.函数:调用thread模块中的start_new_thread()函数来创建线程,以线程函数的形式告诉线程该做什么
2.线程类:调用threading模块,创建threading.Thread的子类来得到自定义线程类。
def f(name):
#定义线程函数
print "this is " + name...
分类:
编程语言 时间:
2014-06-20 12:05:41
阅读次数:
287
题目要求 1000 内可以被 3 或者 5 整除的数字之和
可以很简单地这么写:
print sum( [ i for i in xrange( 1000 ) if i % 3 == 0 or i % 5 == 0 ] )
但是对于10^10的数据,要运行很长时间,可以利用一点鸽巢原理
10^10中能被 3 整除的数据和加上能被 5 整除的数据和减去能被 15 整除的数据和即可,求...
分类:
其他好文 时间:
2014-06-20 11:46:19
阅读次数:
249
以下3步问正确的程序片段:
1.写文件
#! /usr/bin/python3
'makeTextFile.py -- create text file'
import os
def write_file():
"used to write a text file."
ls = os.linesep
#get filena...
分类:
编程语言 时间:
2014-06-20 10:47:27
阅读次数:
278
Swift 是一种兼顾了编译语言的效率和脚本语言的简洁的一种语言。
让我惊讶的是居然支持汉字作为变量的名称,而且还有模板的支持。
其他总的来讲它本身不具有特别与别人不同的东西,很多东西在其他的语言上已经都有了比较成熟的体现,比如JS中的var, python的dict, list, go的多返回值,看起来像是一个大杂烩,很像当年iphone刚刚面世的时候的场景,它所具有的功能,其他的手机基本上...
分类:
移动开发 时间:
2014-06-20 09:15:07
阅读次数:
331
脚本编程语言通常是解释型的。这类程序的执行,是由解释器读入代码,并将其转换成内部的形式,在执行。请注意,解释器本身是一般的编译型程序。
常用的脚本编程语言有 :awk,Perl,Python,Ruby,Shell。这里的Ruby是日本人研发的。
注释:
linux :
1.rm 删除指定的文件
例:rm /Users/apple/Desktop/QQDock.plist...
分类:
系统相关 时间:
2014-06-20 09:10:29
阅读次数:
371
学习Python使用MYSQLdb操作MYSQL数据库...
分类:
数据库 时间:
2014-06-07 14:44:13
阅读次数:
256
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.Thirty days has September,
April, June and November.
All the rest have thirty...
分类:
其他好文 时间:
2014-06-07 13:56:52
阅读次数:
166
Hessian像RMI一样,使用二进制消息进行客户端和服务端的交互,它的二进制消息可以移植到其他非Java的语言中包括PHP、Python、C++和C#。因为Hessian是基于HTTP的,所以HessianSeriviceExporter实现为一个Spring MVC控制器。
HessianSeriviceExporter是一个SpringMVC控制器,它可以接收Hessian请求,并...
分类:
编程语言 时间:
2014-06-07 13:18:26
阅读次数:
309