摘要:[http://www.cnblogs.com/happyframework/p/3255962.html]1. 高效code 与 不常用的函数用法:#带索引的遍历for index, value in enumerate(range(0, 10)): print(index, value)#好用的zip方法for x, y in zip(range(1, 10), range(1, 10)): print(x, y)# 收集多余的位置参数def func_with_collection_rest_parameters(x, y, *rest): print(x, y) ...
阅读全文
摘要:问题1:show error: MSVCP90.dll: No such file or directory创建生成exe文件的脚本添加:import py2exe from distutils.core import setup setup(console=['temp.py'], options = { "py2exe":{"dll_excludes":["MSVCP90.dll"]}})问题2:py2exe 运行失败2:matplotlib 相关dll缺失经实验:import py2exe from distut
阅读全文
摘要:转自:http://www.cnblogs.com/windlaughing/p/3157531.html不管使用什么后台数据库,代码所遵循的过程都是一样的:连接 -> 创建游标 -> 交互(利用游标,使用SQL管理数据)->提交/回滚 ->关闭SQLite 3#导入你需要的库import sqlite3#1、建立与数据库的连接connection=sqlite3.connect('test.db');#2、创建数据游标cursor=connection.cursor()#3、执行一些SQL操作cursor.execute(""&qu
阅读全文
摘要:出处http://blog.csdn.net/sruru/article/details/7803208一: python中有三个内建函数:列表,元组和字符串,他们之间的互相转换使用三个函数,str(),tuple()和list(),具体示例如下所示:>>> s = "xxxxx">>> list(s)['x', 'x', 'x', 'x', 'x']>>> tuple(s)('x', 'x', 'x&
阅读全文
摘要:转自:http://maincoolbo.iteye.com/blog/626655一: 最基本的文件操作当然就是在文件中读写数据。这也是很容易掌握的。现在打开一个文件以进行写操作:1. fileHandle = open ( 'test.txt', 'w' )fileHandle = open ( 'test.txt', 'w' )‘w'是指文件将被写入数据,语句的其它部分很好理解。下一步就是将数据写入文件:1. fileHandle.write ( 'This is a test.\nReally, it is
阅读全文