![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 67
零度可乐
她的一切和谐优美,一切都超出尘世的热情,在她庄严美丽中含着羞怯和文静。
展开
-
python实现单例模式,从始至终都只有一个实例
class Singleton(object): def __new__(cls, *args, **kwargs): if '_inst' not in vars(cls): cls._inst = super(Singleton, cls).__new__(cls, *args, **kwargs) return转载 2013-12-06 21:05:23 · 738 阅读 · 0 评论 -
python paramiko模块的安装使用
一、安装pycryto模块我的机器安装的是python27安装pycryto,安装了easy_install工具,在cmd窗口上执行命令:C:\Python27\Scripts\easy_install.exe pycrypto在执行安装时,出现下面的错误,error: Setup script exited with error: Unable t原创 2014-05-14 21:43:11 · 984 阅读 · 0 评论 -
python学习,计算文件MD5值
# -*- coding: utf-8 -*-import hashlibimport osBUFSIZE = 8192def getFileMD5(strFilePath): f = open(strFilePath, 'rb') m = hashlib.md5() try: while True:原创 2014-05-14 21:26:31 · 571 阅读 · 0 评论 -
python面试题,通过交换a,b中的元素,使[序列a和]与[序列b和]之间的差最小
有两个序列a,b,大小都为n,序列元素的值任意整形数,无序;要求:通过交换a,b中的元素,使[序列a元素的和]与[序列b元素的和]之间的差最小。只能想到最傻的办法import randomimport timedef timeit(func): def _deco(*args, **kwargs): start = time.clock()原创 2014-05-14 21:28:23 · 2043 阅读 · 0 评论 -
python 一些面试题目和面试点供参考
1、// 对结果舍掉尾数1/2==>>>03/2.0==>>>1.53//2.0===>>>1.03.8/2===>>>1.93.8//2===>>>1.02、生成随机数import randomrandom.randint(0,1000)生成一个[0, 1000]之间的整数random.random()生成一个随机的0和1之间的浮点数3、|原创 2014-05-13 22:54:22 · 874 阅读 · 0 评论 -
python rsa加解密
# -*- coding: utf-8 -*-import base64import reimport binasciifrom M2Crypto import RSA, BIOclass RSAED(object): def __init__(self): self.publicKey = None原创 2014-05-14 21:51:43 · 1733 阅读 · 1 评论