首页 软件开发 代码片段 python ( Page 79 )

python 1073

#Python
python 时间处理

在实际中遇到一个时间处理问题,需要将 Sep 06, 2014 19:30 (UTC 时间) 和 当前时间比较早晚,知道 此 2014-09-06 19:30 格式时间的运算。因此…

2015-01-04 643

#Python
python遍历目录树代码

from os.path import basename, isdir from os import listdir def traverse(path, depth=0): pr…

2015-01-04 693

#Python
Python实现登录人人网并抓取新鲜事的方法

from sgmllib import SGMLParser import sys,urllib2,urllib,cookielib class spider(SGMLParser…

2015-01-03 687

#Python
git 提交到 gerrit

#!/usr/bin/env python #coding:utf-8 ''' ''' import os import sys originName = "origin" ver…

2015-01-02 615

#Python
求a到b之间所有质数

def Prime(b): i = 2 while i < b: if 0 == (j%i): return False else: i = i + 1 return Tru…

2015-01-01 301

#Python
Python去除list中的重复元素的最简单办法

初学者经常会遇到如何移除list中重复元素的问题。 这个问题在其他语言中可能需要for循环什么的,而在python中不用这样,非常简单,只需要将list作为set的构造函数构造一个…

2015-01-01 851

#Python
Python汉字转拼音

使用字典和转换程序,将汉字转换为拼音,配置好之后,可以转换为汉字拼音首字符和汉字全拼.这个使用一个字典和转化程序就行.网上有一个署名为caocao的人做了一个python的汉字转拼…

2015-01-01 943

#Python
pygame tetromino 俄罗斯方块

import pygame,sys,time,random from pygame.locals import* FPS = 25 winx = 640 winy = 480 bo…

2014-12-31 872

#Python
pil 放缩图像功能

import Image import os if __name__ == "__main__": infile = raw_input('give me a file with …

2014-12-31 326

#Python
Python将byte数组转换为int

代码 import struct import ctypes def test_struct(buf, offset): return struct.unpack_from(&qu…

2014-12-31 766

#Python
smtplib模块发送邮件

# 导入 smtplib 和 MIMEText import smtplib from email.mime.text import MIMEText # 定义发送列表 mailt…

2014-12-30 774
1 77 78 79 80 81 90