- 博客(16)
- 收藏
- 关注
原创 python常见知识点
python常见知识点 基础 常用函数: print eval dir type range zip enumerate random 格式化输出 format % 基础类型: str list dict tuple set orderdict 引用类型 切片 可变与不可变类型 深浅拷贝copy.copy,copy.deepcopy 三大结构 顺序 选择 循环 f...
2020-03-30 21:38:41 165
原创 python实现js的escape的编码与解码
因为js的escape函数处理非字母数字的字符,简单来说,汉字均以%u开始4个十六进制数表示,其他符号转换与python无过大区别,不做辨识 编码 python3使用urillib进行编码,输出结果与js的escape函数的区别在于,%u变为%5Cu,因此只需要在输出时,再进行一次替换即可 py2下为urllib.quote(),其他基本不变 #编码 import urllib print(url...
2018-12-30 20:02:05 3157 1
原创 python 使用twilio免费发送短信
这里写自定义目录标题python 使用twilio免费发送短信登录获取发送用号码在python中测试,并发送短信 python 使用twilio免费发送短信 使用twilio提供的服务,貌似使用接口需要付费(即自动验证接收方手机号功能一类),基本的手动添加接收方手机号验证是免费的。 主要功能:发送一个带有twilio的账号id和验证token(固定不变的)+短信内容,接收方(提前验证通过)可以收...
2018-12-30 19:43:02 2026
原创 13rd step for python:recursion && breadth traversal && ergodic traversal && time module
#递归遍历import osdef getAllDir(path,sp=" " ): filesList = os.listdir(path) #print(filesList) sp += " " for fileName in filesList: fileAbsPath = os.path.join(path,fileName) if o...
2018-06-19 10:13:03 228
原创 12th step for python :decorator && partial function
decorator sometime we want to text a function ,but we need not to change this function ,we can use the decorator:def outer2(fun): def inner(): print("inner") fun() return inner@out...
2018-06-19 10:12:26 151
原创 10th step for python:file operate (open ,read, write, close) && file operter && windows control && c
open ,operte,closefp = open("a.txt","r+")fw = open("b.txt","w")a = fp.read()print(a)s = "aaaaaa"fw.write(a)#this opertor will be excuted when the file closed,is not imediately to do.fw.flush()#if we w...
2018-06-19 10:11:17 254
原创 9th step for python:exception && assert && import module && Package && publish module && use pip ins
exceptiontry: num = int(input("请输入一个整数")) result = 8 / num print(result)except ZeroDivisionError : print("不可以输入零")except ValueError : print("请勿输入除整数外的字符")except Exception as result : ...
2018-06-19 10:10:12 141
原创 8th step for python:__new__ && single sample design model
__new__it give the tmp_space when a object is instantiation and return it for object,after that the __init__ function will be start as nomalbut need to give the super().__new__(cls) ,class MusicPlaye...
2018-06-19 10:08:50 165
原创 7th step for python:class parament && class function && static function
class Tool(): count = 0 def __init__(self, name): self.name = name Tool.count += 1a = Tool("a")b = Tool("b")print(Tool.count)like the globe parament ,but it is for a class ,no...
2018-06-19 10:08:15 154
转载 python-6th step for python :simple Method encapsulation && privete parament && inheritance
class HomeItem : def __init__(self, name, area): self.name = name self.area = area def __str__(self): return "%s 的面积是%s"% (self.name, self.area)class house : def __init__...
2018-05-24 18:12:41 147
原创 python-5th step for python :built-in function and class
built-in functionkey char:__function_name__dir(functionname)will show this functions' built-in functhonclasskey char:class Class_Name : def function_name (self, parament) : printinstantiatio...
2018-05-24 13:04:38 196
原创 python-4th step for python
change two parament:a = a+bb = a-ba = a-bor:a,b = (b,a)default parament:def a(b,m="",c=false): d = "e" if not c : d = "f"a(g,c = true)more parament :more than one parament needed for one ...
2018-05-24 13:04:05 807
原创 python -3rd step for python :Advanced variable
Listlike the array in other programming languagea = ['k1'','k2','k3']index->a[0] a[1] a[2]List :key signal is "[]"a.a.append a.extend a.insert a.remove a.sort a.count a.index a.pop a.reverseTup...
2018-05-24 13:03:35 160
原创 python -2nd step for python : function_step
filename:a.pydef function_name(parameter1,parameter2) :"""XXXXX,this is the note to introduction this function""" print return XXfilename:b.pyimport a.pyb=a.function_name(p1,p2)
2018-05-24 13:02:41 173
原创 python基础-1st step for python
#!/usr/bin/pythonXX---means which version of python to create a program# XXXXXXX---means single notes ,for note"""XXXXXXXXXXXXXXX"""---means numbers notes,for notearithmetic operator:+,-*,///,%----mea...
2018-05-24 13:02:02 946
原创 python 基础0-linux常见命令
ls |-show this list |-ls -l show the more information |- ls -a show a file which is hide |-ls ...
2018-05-24 12:57:39 193
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人