![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
tmy4972457
这个作者很懒,什么都没留下…
展开
-
类方法和静态方法的区别以及注意点
1、类方法类方法的第一个形参是类,需要用装饰器@classmethod来进行装饰,对于类方法,第一个参数必须是类对象,一般以cls作为第一个参数。举例子classCat(object): __type = "猫" # 类方法,用classmethod来进行修饰 @classmethod def get_type(cls): return cls.__typeprint(Cat.get_type...原创 2020-08-03 14:47:04 · 435 阅读 · 0 评论 -
Python中的私有属性和私有方法
首先来比较一下java中的各种修饰符的访问权限 当前类 同包 子孙类 其它包 public √ √ ...原创 2019-04-16 15:36:00 · 910 阅读 · 0 评论 -
Python中的getpass模块学习
getpass模块提供了平台无关的在命令行下输入密码的方法; 该模块主要提供:两个函数: getuser, getpass一个报警: GetPassWarning(当输入的密码可能会显示的时候抛出,该报警为UserWarning的一个子类)1、getpass函数from getpass import getpasspwd=getpass()Warning (from warnings ...原创 2019-04-17 10:40:05 · 2887 阅读 · 0 评论 -
xpath与css的类似功能对比
总结定位方式XPathCss标签//divdivBy id//div[@id='eleid']div#eldidBy class//div[@class='eleclass']div.eleidBy 属性//div[@title='Move mouse here']div[title=Move mouse here] div[title^=...原创 2019-04-22 15:59:06 · 304 阅读 · 0 评论 -
python处理json数据(复杂的json转化成嵌套字典并处理)
import requests,jsonurl=‘json地址’result=requests.get(url,)content=result.textdict = json.loads(content)list_key = []j = 0for key in dict[‘data’]:list_key.append(key)for i in list_key:print(’-...原创 2019-04-23 09:49:36 · 9454 阅读 · 0 评论 -
pyhon3的用法记录
python3python3字典存在pop方法pop方法直接删除键值对gift={‘A’:‘a’,‘B’:‘c’,‘C’:‘c’,‘D’:‘d’}gift.pop(‘A’)print (gift)结果为{‘B’: ‘c’, ‘C’: ‘c’, ‘D’: ‘d’}...原创 2019-07-30 17:33:28 · 137 阅读 · 0 评论