Python
sfzoro
这个作者很懒,什么都没留下…
展开
-
Python安装
1.下载地址(my网盘) http://pan.baidu.com/s/1gdIRSwr2.安装 :注意选上 add path (没有选上自己去环境变量中添加,跟java的差不多的) 再直接下一步就好了!3.测试安装情况 win+R cmd python原创 2015-04-23 22:50:37 · 498 阅读 · 0 评论 -
python 数据类型和变量
在cmd中cls是用来清空屏幕的.当内容多时可以用用!原创 2015-04-26 21:31:26 · 520 阅读 · 0 评论 -
python 输入输出,注释的使用
用EidtPlus新建一个py文件.代码如下(不能用notepad)#-*- coding:cp936 -*-print 'hello, python'print 'first 1', 'second 2'print '100 + 200 =', 100+200#用户输入"""用户输入"""name = raw_input()print '输入的数据:', namename =原创 2015-04-26 00:20:07 · 1526 阅读 · 0 评论 -
python (3)编码的疑惑
1.说明下面代码中两行#第一行注释是为了告诉Linux/OS X系统,这是一个Python可执行程序,Windows系统会忽略这个注释;第二行注释是为了告诉Python解释器,按照UTF-8编码读取源代码,否则,你在源代码中写的中文输出可能会有乱码。#!/usr/bin/env python# -*- coding: utf-8 -*-print u'中文测试正原创 2015-04-27 23:51:57 · 717 阅读 · 0 评论 -
python (4)
#!/usr/bin/env python# -*- coding: utf-8 -*-print u'中文'print u'阿飞'classmates = ['Michael', 'Bob', 'Tracy', u'阿飞']print classmatesprint classmates[3]len(classmates)print classmates[-2]classmat原创 2015-04-28 21:27:00 · 538 阅读 · 0 评论 -
python 5 条件判断和循环
#!/usr/bin/env python# -*- coding: utf-8 -*-age = 3if age >= 18: print 'adult'elif age >= 6: print 'teenager'else: print 'kid'print '----------------------'names = ['jie', 'bob', 'trcy']f原创 2015-05-01 23:57:36 · 891 阅读 · 0 评论 -
python file 操作
代码环境; windows + python2.7 + notepad++ (使用插件PyNPP notepad++ 插件管理中可以下载使用)1.打开包含中文路径文本 #!/usr/bin/env python# -*- coding: utf-8 -*-uipath = u'F:\VC\编程资料.txt' #或 unicode(filepath, 'utf-8')f = ope原创 2015-12-13 22:22:29 · 832 阅读 · 1 评论 -
安装tushare库
1.为了抓取大盘数据找了很久,开始想法是自己写爬虫取新浪或雪球网站抓数据,发现好麻烦没有自己直接方法,最后到处逛时发现有tushare库(哈哈不用麻烦,果然是人生苦短我用python) tushare 文档地址 http://tushare.org/trading.html#id22.安装tushare遇到不少麻烦,自己装了python2.7 后来又装了epd_free-7.3-2-win-x8原创 2016-05-30 22:02:53 · 10726 阅读 · 0 评论 -
Python urllib 爬取基金数据
1.urllib 使用笔记urlopen(url,data,timeout) 第一个参数url即为URL,第二个参数data是访问URL时要传送的数据,第三个timeout是设置超时时间。 第二三个参数是可以不传送的,data默认为空None,timeout默认为 socket._GLOBAL_DEFAULT_TIMEOUT 第一个参数URL是必须要传送的,在这个例子里面我们传送了百度的URL原创 2016-05-31 23:06:24 · 3971 阅读 · 0 评论