在做文本处理时,有一些数据存储到了excel中,为了将数据导入mongodb,引入了pymongo,xlrd包 利用pymongo包进行数据库的连接 使用xlrd包读取excel数…
# 求x以内的所有平方数: [x for x in xrange(1,100) if not x % math.sqrt(x)] # 求x以内(不包括x)的所有质数: filter…
#coding=utf8 import urllib2 import codecs import re import time from lxml import etree url…
#演示可变参数函数 #!/usr/bin/python def f1(a,b): print a,b def f2(a,*b): print a,b def f3(a,**b): …
#!/usr/bin/env python3 """ turtle-example-suite: tdemo_planets_and_moon.py Gravitational s…
#!/usr/bin/python # -*- coding: utf-8 -*- import os def del_files(path): for root , dirs, …
from math import * degrees(asin(0.5))
import pygame,sys,random from pygame.locals import* FPS = 10 winx = 640 winy = 480 cellsiz…
import sys @tailcall def fact(x, acc=1): if x: return fact(x.__sub__(1), acc.__mul__(x)) r…
print("Mv has come")
def printMove(fr,to): print 'move from ' + str(fr) + ' to ' + str(to) def Towers(n,fr,to,s…
python collection模块中几种数据结构(Counter、OrderedDict、namedtup)