按类别查询搜索结果
关于关键词 的检测结果,共 2200
Aexn | 2016-07-01 15:09:39 | 阅读(0) | 评论(0)
点击(此处)折叠或打开#列表                                name = [1,2,3,4,"test","log"]  ...【阅读全文】
duoyidian | 2016-06-29 14:47:31 | 阅读(570) | 评论(0)
使用python开发时,由于python的开源生态圈非常的给力,对于实现同一个功能,往往在这方面的类库非常多,而开发者也同样面临着如何选择最佳的 类库作为辅助开发的工具。本文将记录本人在使用python处理xml格式数据时测试过的类库,有些类库由于先天不足,无法支持一些特性,涉及的类库或模 块有xml(python自带)、libxml2 ...【阅读全文】
Aexn | 2016-06-28 14:15:30 | 阅读(430) | 评论(0)
laoliulaoliu | 2016-06-22 16:19:03 | 阅读(1500) | 评论(0)
原文地址:http://www.qmailer.net/archives/251.html1在Python程序内部,通常使用的字符串为unicode编码,这样的字符串字符是一种内存编码格式,如果将这些数据存储到文件或是记录日志的时候,就需要将unicode编码的字符串转换为特定字符集的存储编码格式,比如:UTF-8、GBK等...【阅读全文】
winecork | 2016-06-22 09:55:13 | 阅读(950) | 评论(0)
参看:http://www.cnblogs.com/fnng/p/3576154.html点击(此处)折叠或打开import urllib import redef getHtml(url):    page = urllib.urlopen(url)    html = page.read()...【阅读全文】
shenyue_sam | 2016-06-22 09:49:44 | 阅读(16340) | 评论(0)
在linux上,执行python脚本,#!/bin/env pythonprint 'hello'用 python a.py 的方式执行没有问题,用 ./a.py 的方式执行,报错“: No such file or directory”shell中直接执行 env python 没问题,可以进入python解释器。修改a.py,不使用env,直接指定python的路径,...【阅读全文】
【Python/Ruby】 python collections系
TT小饭 | 2016-06-19 10:47:45 | 阅读(480) | 评论(0)
【Python/Ruby】 python两个典的对比
大镇 | 2016-06-14 15:01:32 | 阅读(0) | 评论(0)
这几天,自己写了个字典的对比参考了网上的一些例子,发现很多例子并不完善。点击(此处)折叠或打开#coding:utf-8def dict_compare(dict1, dict2, except_key=''):    """    ...【阅读全文】
【Python/Ruby】 Python中的线程
大镇 | 2016-06-07 14:07:12 | 阅读(780) | 评论(0)
理解Python中的线程转自: http://www.jianshu.com/p/4a13a05e4f1f#字数1695 阅读731 评论1 喜欢5郑重声明版权属于 http://agiliq.com/blog/2013/09/understanding-threads-in-python/我们将会看到一些在Python中使用线程的实例和如何避免线程之间的竞争。你应当将下边的例子运...【阅读全文】
派大星861205 | 2016-06-06 22:28:06 | 阅读(210) | 评论(0)
class Solution(object): def lengthOfLongestSubstring(self, s): charSet=set() lengthList=[] length=0 for c in s: if c not in charSet: charSet.add(c) length+=1 else: lengthList.append(length) ...【阅读全文】
派大星861205 | 2016-06-06 22:27:40 | 阅读(310) | 评论(0)
class Solution(object): def lengthOfLongestSubstring(self, s): charSet=set() lengthList=[] length=0 for c in s: if c not in charSet: charSet.add(c) length+=1 else: lengthList.append(length) ...【阅读全文】
sxm5211258 | 2016-06-06 21:39:01 | 阅读(1060) | 评论(0)
点击(此处)折叠或打开安装readline-devel模块#yum -y install readline-devel重新编译python2.7版本#./configure --prefix=/usr/local/python2.7#make && make install...【阅读全文】
hmchzb19 | 2016-06-04 11:13:22 | 阅读(1220) | 评论(0)
下面两段代码出自http://rosettacode.org/wiki/Roman_numerals/Encode#Python点击(此处)折叠或打开def to_roman(x):    anums = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]    rnums = "M CM D CD C XC L...【阅读全文】
派大星861205 | 2016-06-02 22:20:44 | 阅读(630) | 评论(0)
#!/usr/bin/python3.5# coding: UTF-8from copy import deepcopyimport matplotlib.pyplot as pltimport numpy as npfrom bisect import bisecttorqueCurve=[]powerCurve=[]#起步转速startRpm=1300class Transmission():    def __init__(self,gears,efficiency=0.9,nowGear=1):  ...【阅读全文】
古丁高手 | 2016-05-26 15:02:06 | 阅读(1200) | 评论(0)
1.列表推导  看几个例子,一切就明白了。2.迭代器3.生成器【阅读全文】
【Python/Ruby】 tornado.gen
laoliulaoliu | 2016-05-20 12:06:44 | 阅读(1390) | 评论(0)
原文地址:http://blog.xiaogaozi.org/2012/09/21/understanding-tornado-dot-gen/Tornado 通过 @asynchronous decorator 来实现异步请求,但使用的时候必须将 request handler 和 callback 分离开,tornado.gen 模块可以帮助我们在一个函数里完成这两个工作。下面是官方的一个例子:...【阅读全文】
zhongtang | 2016-05-15 11:16:02 | 阅读(6400) | 评论(0)
python2.7下urllib2的connection自动close的原因及解决办法【阅读全文】
steve78926 | 2016-05-12 23:40:21 | 阅读(1240) | 评论(0)
加盐哈希算法【阅读全文】
nathanvorbei | 2016-05-09 18:01:01 | 阅读(1860) | 评论(0)
我们工作中会遇到多层列表,例如:arr[['a','b','1'],['c','d','2'],['e','f','0']],我们如何根据arr[][2]进行排序?1. 一般常用的是arr.sort()或者sorted(arr)排序。2. arr.sort(key=lamdba x:x[2])参考:http://blog.chinaunix.net/uid-20775448-id-4222915.html...【阅读全文】
呆若 | 2016-05-09 14:22:56 | 阅读(1500) | 评论(0)
task_master.txttask_worker.txt点击(此处)折叠或打开#!/usr/bin/env python3#-*- coding:utf-8 -*-''''''import time,random,queuefrom multiprocessing.managers import BaseManagertask_...【阅读全文】