摘要: import time time.sleep(1)#暂停时间 time.time()#显示当前系统时间戳 t=time.localtime()#结构化当地时间,可以将结构化时间想象成一个类 print(t.tm_year)#通过属性访问 阅读全文
posted @ 2019-07-11 22:38 coldplaycode 阅读(182) 评论(0) 推荐(0) 编辑
摘要: #import cal,time #导入模块名可以看作导入一个变量 #from cal import add # from cal import *#引入所有变量 *代表所有 占内存 不推荐 # # # print(cal.add(3,6))#必须使用模块名加函数的方法,不然解释器会在本文件中查找函数 # # print(cal.sub(10,5)) # # print(add(100,1... 阅读全文
posted @ 2019-07-05 11:25 coldplaycode 阅读(190) 评论(0) 推荐(0) 编辑
摘要: user_list=[ {'name':"alex","pwd":'123'}, {'name':'tang','pwd':'123'}, {'name':'sb','pwd':'123'} ] current_dict={'username':None,'login':False} def auth(auth_type): def auth_func(func). 阅读全文
posted @ 2019-07-04 14:50 coldplaycode 阅读(433) 评论(0) 推荐(0) 编辑
摘要: #装饰器:本质就是函数,功能是为其他函数添加附加功能 #原则:1.不修改被装饰函数的源代码 2.不修改被修饰函数的调用方式 #装饰器=高阶函数+函数嵌套+闭包 #函数嵌套: # def bar(): # print("form bar") # # # def foo(): # print("from foo") # def test(): # ... 阅读全文
posted @ 2019-06-26 07:15 coldplaycode 阅读(268) 评论(0) 推荐(0) 编辑
摘要: #我是用的window service2008系统,在配置服务器时由于是用php进行搭建 #首先我安装好phpstudy,通过服务器ip访问,显示了个helloworld,我查看了phpstudy里的端口和phppagehome #发现里面的首页和网站根目录是默认的路径页面,然后添加域名及根目录,将 阅读全文
posted @ 2019-06-20 10:41 coldplaycode 阅读(459) 评论(0) 推荐(0) 编辑
摘要: #高阶函数定义: #1.函数接受的一个参数是一个函数名 #2.函数的返回值是一个函数名 #3.满足上述条件任意一个,都可以称为高阶函数 #装饰器:本质就是函数,功能是为其他函数添加附加功能#原则:1.不修改被装饰函数的源代码 2.不修改被修饰函数的调用方式#装饰器=高阶函数+函数嵌套+闭包 import time # def test(func): # print(func) #... 阅读全文
posted @ 2019-06-20 09:09 coldplaycode 阅读(408) 评论(0) 推荐(0) 编辑
摘要: x="hello" #print(dir(x)) iter_test=x.__iter__() #print(iter_test) # print(iter_test.__next__()) # print(iter_test.__next__()) #可迭代对象就是迭代器 l=[1,2,3] # for i in l:#先执行i=l.__iter__() ,i.__next__() f... 阅读全文
posted @ 2019-06-17 22:12 coldplaycode 阅读(221) 评论(0) 推荐(0) 编辑
摘要: #文件合并与文件归档 #cat /etc/passwd > new_pass.txt (创建一个新的文档并将cat/etc/passwd的内容合并进来) #echo "xxxx" >> new_pass.txt(追加内容到文档末尾) #echo "xxxx" > new_pass.txt(写入新内容 阅读全文
posted @ 2019-06-12 16:54 coldplaycode 阅读(150) 评论(0) 推荐(0) 编辑
摘要: # f=open('code.txt','rb')#b的方式不能指定打开编码格式,以二进制的方式打开文件 # data=f.read() # print(data) # #encode 编码 decode解码 # print(data.decode(encoding="GBK")) # f.close() # # f=open("test22.py",'wb')#b的方式不能指定编码,以... 阅读全文
posted @ 2019-06-12 15:38 coldplaycode 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #r w a 文件读取操作 默认打开为读操作 #f=open('coldplay.txt','r',encoding="utf-8")#open函数默认已系统编码方式打开windows默认编码方式为Gbk,如果我们文件存储的字符编码为utf-8#那么需要指定编码,防止乱码 #print(f) #data=f.read() #print(data) # print(f.readable())#判... 阅读全文
posted @ 2019-06-12 11:38 coldplaycode 阅读(164) 评论(0) 推荐(0) 编辑

coldplaycode