摘要:
1.常用符号 . 匹配任意字符 * 匹配前一个字符0次或无限次 ? 匹配前一个字符0次或1次 .* 贪心算法 .*? 非贪心算法 ()... 阅读全文
posted @ 2016-06-09 21:06
Kimisme
阅读(298)
评论(0)
推荐(0)
摘要:
1.创建一个类 class Employee: empCount = 0 def __init__(self,name,salary): self.name = name self.salary = salary Employee.empCount +=1 def displayEmployee(self): ... 阅读全文
posted @ 2016-06-09 17:33
Kimisme
阅读(235)
评论(0)
推荐(0)
摘要:
1.try…except…else try: fn = open("aa.txt","r") fn.write("这是一个测试文件") except Exception as e: print "错误提示",e.message else: print "写入内容成功" fn.close() 2.try…finally try: ... 阅读全文
posted @ 2016-06-09 15:42
Kimisme
阅读(207)
评论(0)
推荐(0)
摘要:
1.读取键盘输入 msg = raw_input("Please enter :") print "you input ",msg #可接受Python表达式作为输入 msg2 = input("请输入:") print "你输入了",msg2 2.读文件 fo = open("foo.txt","r") print fo.read() fo.close() 3.写文件 ... 阅读全文
posted @ 2016-06-09 14:59
Kimisme
阅读(285)
评论(0)
推荐(0)
摘要:
1.介绍 函数代码块以def关键字开头,后接函数标识符名称和圆括号; return[表达式]结束函数,不带表达式的return,默认返回None 2.函数的简单调用 def printme(str): print str return printme(11) 3.传递参数 所有参数在Python里都是按引用传递的 def changeme(mylist... 阅读全文
posted @ 2016-06-09 10:52
Kimisme
阅读(244)
评论(0)
推荐(0)
摘要:
输出当前时间 import time#引入time模块 print time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()) 输出日历 import calendar; cal = calendar.month(2016,1); print cal; 进度条 import sys import time def vi... 阅读全文
posted @ 2016-06-09 10:29
Kimisme
阅读(206)
评论(0)
推荐(0)
摘要:
一、概要 二、数字类型(Numbers) 1.Python支持的数字类型 int(有符号整型) long(长整型) float(浮点型) complex(复数) 2.类型转换 int(x ) #将x转换为一个整数 long(x) #将x转换为一个长整数 float(x ) ... 阅读全文
posted @ 2016-06-09 10:21
Kimisme
阅读(301)
评论(0)
推荐(0)

浙公网安备 33010602011771号