码迷,mamicode.com
首页 >  
搜索关键字:print    ( 43532个结果
python之生成器
def repeater(value): while True: new = yield value print(first, new) if new is not None: value = new print('second', value) 1.调用函数,并且使用next()方法 >>>r..... ...
分类:编程语言   时间:2016-06-04 17:58:48    阅读次数:215
perl中tr的用法(转载)
转载:http://blog.sina.com.cn/s/blog_4a0824490101hncz.html (1)/c表示把匹配不上的字符进行替换. $temp="AAAABCDEF"; $count=$temp=~tr/A/H/c; print "$temp\t$count\n"; 结果:AA ...
分类:其他好文   时间:2016-06-04 14:56:47    阅读次数:1404
Python基础第四天
必须掌握的内置函数 bytes() divmod() eval() exec() isinstance() range() 常用函数 1.数学相关 abs(x) abs()返回一个数字的绝对值。如果给出复数,返回值就是该复数的模。 >>>print abs(-100) 100 >>>print ab ...
分类:编程语言   时间:2016-06-04 13:18:45    阅读次数:250
python 队列
栈:后进先出 单向队列:先进先出 双向队列: import collections d = collections.deque() d.append('1') print(d) class: append: Add an element to the right side of the deque. ...
分类:编程语言   时间:2016-06-04 12:10:29    阅读次数:195
python 内置函数2
以后自己看自己的博客的话,我选择死亡。 divmod(a,b) #返回a//b的值和余数 s = divmod(97,10) print(s) n1, n2 = divmod(89,5) print(n1,n2) isinstance() #判断对象是否是某个类的实例 isinstance() #判 ...
分类:编程语言   时间:2016-06-04 12:10:23    阅读次数:202
Python之路4Day
内置函数处理li = [11,22,33,44]def f1(arg): arg.append(55) li = f1(li) fi(li) print(li) 函数默认返回值None 参数引用例题:1.将字符串"老男人"转换成UTF-8编码的字节类型 s = "lannanren" (字节)byt... ...
分类:编程语言   时间:2016-06-04 11:57:29    阅读次数:226
python 学习笔记3
# li = [11,22,33,44]# def f1(arg):# arg.append(55)# # li = f1(li)# f1(li)# print(li)# 不太重要# 是否可以被执行被调用# def f1():# pass## f1()# f2 = 123## f2()# print ...
分类:编程语言   时间:2016-06-04 07:02:00    阅读次数:195
python 学习之函数
1.内置函数 callable() #定义是否能调用 def (f1): falsef1()print(callable(f1)) #判断f1是否能被调用,可以返回True 否则返回False chr() 用来做ASCII码转换 a=chr(65) print(a) A #65所对应的ascii码o ...
分类:编程语言   时间:2016-06-04 07:00:43    阅读次数:170
Python之路【第四篇】:Python基础(19)——装饰器
#普通装饰器# (@+函数名),需要记住关键两点:#功能:#1、自动执行outer函数,并且将其下面的函数名f1当作参数传递#2、将outer函数的返回值,重新赋值给f1# #装饰器必备# ####第一:函数名和执行函数##### def foo(): #创建函数# print('hello') # ...
分类:编程语言   时间:2016-06-04 06:59:41    阅读次数:221
python 第四天 笔记
li=[11,22,33,44]deffi(arg):arg.append(66)print(fi(li))返回none简单验证码程序random li=[] i(): r=random.randrange(,) r==i: num=random.randrange(,) li.append((num)) : tmp=random.randrange(,) c=(tmp)整数对应的ascii码 li.append(c) r=.join(li) (r)
分类:编程语言   时间:2016-06-04 01:57:26    阅读次数:232
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!