随笔分类 -  Python

该文被密码保护。
posted @ 2014-12-28 16:34 zifenger 阅读(5) 评论(0) 推荐(0)
摘要:今天用到Excel的相关操作,看了一些资料,借此为自己保存一些用法。 参考资料: python excel 的相关操作 python操作excel之xlrd python操作Excel读写--使用xlrd 1 # -*- coding: UTF-8 -*- 2 3 import x... 阅读全文
posted @ 2014-09-20 23:34 zifenger 阅读(298) 评论(0) 推荐(0)
摘要:文本中保存的内容为:{ 'QQQ': [0.067, 0.167, 0.2, 0.033, 0.233, 0.267, 0.1, 0.133], 'TTT': [0.5, 0.375, 0.25, 0.3, 0.6, 0.333, 0.857, 0.636, 0.667, 0.55... 阅读全文
posted @ 2014-08-28 15:58 zifenger 阅读(20622) 评论(1) 推荐(0)
摘要:参考资料:mac os x下python安装MySQLdb模块 http://www.codeif.com/post/1073/MAC OSX使用Python安装模块有关问题 http://www.myexception.cn/operating-system/1616547.html 在Ma... 阅读全文
posted @ 2014-08-01 22:00 zifenger 阅读(4075) 评论(0) 推荐(0)
摘要:经常用到MySQL数据库,最近学着用Python操作数据库,在网上看了一些资料,整理了一份适合自己的,记录一下,免得过段时间忘记了。创建表时,自增的主键 id。循环插入数据。#!/usr/bin/env python #-*-coding:UTF-8-*-import MySQLdbimport timedef dbConnection(): """数据库的连接""" try: #建立和数据库系统的连接 conn = MySQLdb.connect(host='localhost', port=3306, user=& 阅读全文
posted @ 2014-01-13 14:16 zifenger 阅读(736) 评论(0) 推荐(0)
摘要:2013-11-05 22:02:14|1.安装使用PyInstaller需要安装PyWin32。下载与Python对应的PyInstaller版本,解压后就算安装好了。例如,安装了PyInstaller-2.1版本,解压后的路径和文件夹下的内容如下所示:2.生成exe文件Python程序的目录为 F:\hello.py在命令行中进入pyinstaller所在的目录,运行python pyinstaller.py F:\hello.py在PyInstaller-2.1目录下,生成文件夹hellohello目录下有文件exe文件在dist目录下如果将python文件复制到pyinstaller. 阅读全文
posted @ 2014-01-12 13:27 zifenger 阅读(2505) 评论(0) 推荐(0)
摘要:2013-10-18 10:07:03|import copya = [1,2,3,['a','b']]b = ac = a[:]d = copy.copy(a)e = copy.deepcopy(a)print "a ",aprint "= ",bprint "[:] ",cprint "copy ",dprint "deepcopy ",eprinta[0] = 9print "a ",aprint "= ",bprin 阅读全文
posted @ 2014-01-12 12:43 zifenger 阅读(2876) 评论(0) 推荐(0)
摘要:2013-07-27 21:01:37| 在Windows下,用Python从.txt文件中读取字符串,并用正则表达式匹配中文,在网上看了方法,用的时候发现中文没有被匹配。 txt文件中的内容如下: Python代码如下: 代码执行后,中文没有被匹配: 修改代码如下: 代码执行后,中文被匹配,中文的标点符号也被匹配: 阅读全文
posted @ 2014-01-12 12:33 zifenger 阅读(20155) 评论(0) 推荐(0)