Python
python
import time import datetime today = datetime.datetime.today()+ datetime.timedelta(days =10) print today
import csv def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs): csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs) for row in csv_reader: yield [unicode(cell, 'utf-8') for cell in row] spamReader =unicode_csv_reader(open('a.csv', 'rb')) for row in spamReader: print ', '.join(row)
下午网上检索了下Python排列组合代码还真多!
自己测试的是用循环实现,检索到的都是递归,还是循环快点!
要用py写彩票分解合并代码可是会少很多行!
强!很好用!
#http://code.activestate.com/recipes/577031-simple-permutations/ def perm(chars, m, wrd="", wrds=[]): if len(wrd) == m: return wrd for i in range(0, len(chars)): w = perm(chars, m, wrd+chars[i]) if type(w) == type(""): wrds.append(w) return wrds
#http://code.activestate.com/recipes/190465/ def xcombinations(items, n): if n==0: yield [] else: for i in xrange(len(items)):
import urllib data = urllib.urlopen('http://trade.cpdyj.com/trade/bjvsdpf.go?expectId=101105&playId=SPF').read() print data
原因是本地没有安装vc 环境导致,装个vs2008搞定,如果使用了MinGW,那就修改下编译命令
python setup.py build --compiler=mingw32 --verbose
再点安装就可以了!
或者修改py 目录下Lib/distutils/distutils.cfg 为
[build]
compiler=mingw32
以前用asp和php做网站时几乎全都是用文本编辑工具,连个调试都没有,这年头,啥都全的没治了,想要啥有啥!强大!太强大了!几年不关心 落伍了!
最近有时间就看看Python 相关的web框架,哈哈!
pyglet provides an object-oriented programming interface for developing games and other visually-rich applications for Windows, Mac OS X and Linux. Some of the features of pyglet are:
- No external dependencies or installation requirements. For most application and game requirements, pyglet needs nothing else besides Python, simplifying distribution and installation.
Drupal theme by Kiwi Themes.