![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
没事学学phython
skylovesky
这个作者很懒,什么都没留下…
展开
-
python学习笔记——1_变量
# coding: UTF-8#!/usr/bin/python# 测试浮点数print 10E-4# 测试 三引号print ''' This is test.'what's test?''python string test.''''#测试转义符号print 'what\'s the test'#测试末尾的 “\”print 'what the test原创 2013-09-26 13:10:14 · 754 阅读 · 0 评论 -
Python高级编程技巧
http://blog.jobbole.com/61171/转载 2014-05-09 17:07:10 · 510 阅读 · 0 评论 -
python学习笔记—— 用的测试文件
poem.txtProgramming is funWhen the work is doneif you wanna make your work also fun: use Python!test_module.py#coding:utf-8def sayHi(): print "This testModule speaking!"原创 2013-09-26 13:38:03 · 712 阅读 · 0 评论 -
python学习笔记——4_数据结构
#coding:UTF-8#列表开始#help(list)shopList=['apple','mango','carrot','banana']print 'I have',len(shopList),'items to purchase'print 'These items are:'for item in shopList: print itemprint '\n原创 2013-09-26 13:15:34 · 856 阅读 · 0 评论 -
python学习笔记——6_面向对象
#coding:UTF-8#类 开始class Person: passp=Person()print p'''结果:'''#类 结束#=====================================#对象的方法 开始class Person2: def sayHi(self): print 'hello,world!'原创 2013-09-26 13:20:39 · 679 阅读 · 0 评论 -
python学习笔记——7_输入输出
#coding:UTF-8#文件 开始poem='''\Programming is funWhen the work is doneif you wanna make your work also fun: use Python!'''f=file('poem.txt','w') #文件不存在 自动创建f.write(poem)f.close()f=fil原创 2013-09-26 13:21:42 · 698 阅读 · 0 评论 -
python学习笔记——8_异常
#coding:UTF-8#try.. except 开始'''我们把所有可能引发错误的语句放在try块中,然后在except从句/块中处理所有的错误和异常。except从句可以专门处理单一的错误或异常,或者一组包括在圆括号内的错误/异常。如果没有给出错误或异常的名称,它会处理 所有的 错误和异常。对于每个try从句,至少都有一个相关联的except从句。如果某个错误或异常没有被原创 2013-09-26 13:23:05 · 733 阅读 · 0 评论 -
python学习笔记——5_解决问题编写脚本
#coding:UTF-8import osimport timesource=['test_module.py','test_module.pyc']target_dir='';today=target_dir+time.strftime('%Y%m%d')now=time.strftime('%H%M%S')comment=raw_input('Enter a comment原创 2013-09-26 13:18:59 · 726 阅读 · 0 评论 -
python学习笔记——3_模块
#coding:UTF-8#使用sys模块开始'''首先,我们利用import语句 输入sys模块。基本上,这句语句告诉Python,我们想要使用这个模块。sys模块包含了与Python解释器和它的环境有关的函数。当Python执行import sys语句的时候,它在sys.path变量中所列目录中寻找sys.py模块。如果找到了这个文件,这个模块的主块中的语句将被运行,然后这原创 2013-09-26 13:15:05 · 738 阅读 · 0 评论 -
python学习笔记——2_函数
# coding:UTF-8#定义函数开始def sayHello(): print 'hello world'sayHello()#结果:hello world#定义函数结束#=================================#函数带参数 开始''' ”,“是连接符号 '''def printMax(a,b): if(a>b):原创 2013-09-26 13:12:49 · 702 阅读 · 0 评论 -
Scrapy:Python的爬虫框架
官方文档:http://doc.scrapy.org/en/latest/intro/tutorial.htmlGitHub项目主页:https://github.com/scrapy/scrapy转载 2014-05-09 17:05:35 · 718 阅读 · 0 评论