摘要:
复制: 1. copy() 复制列表 语法:列表序列.copy() 示例: name_list = ['TOM', 'LINA', 'SAM'] list01 = name_list.copy() # 用list01来接收复制后的列表 print('原始列表:', name_list) print( 阅读全文
摘要:
修改: 1. 修改指定下标的数据 示例: # 修改指定下标的数据 name_list = ['lina', 'LiMing', 'Sam'] name_list[1] = 'zhangsan' print(name_list) 结果: 2. reverse()函数:逆序 语法:列表.reverse( 阅读全文
摘要:
一、列表的常用操作-判断 1、in 判断指定数据是否在列表中, 在列表中返回True, 不在列表中返回False 示例: # 1、in 判断指定数据是否在列表中, 在列表中返回True, 不在列表中返回False my_list = ['lina', 'LiMing', 'Sam'] print(' 阅读全文
摘要:
查找有两种方法 1、下标查找数据 示例: # 1、下标查找数据 name_list = ['abc', 'liming', 'lily'] print(name_list[0]) print(name_list[1]) print(name_list[2]) 结果: 2、查找数据的函数 index( 阅读全文
摘要:
1、 startswith(): 判断字符串是否以某个子串开始,是则返回True,否则返回False 示例: my_str = 'hello world and my and test and python' # 1、 startswith(): 判断字符串是否以某个子串开始,是则返回True,否则 阅读全文
摘要:
1、lstrip():删除左侧空白字符 实例: my_str = ' hello world and my and test and python ' # 原始字符串 print(my_str) # lstrip() 删除左侧空白字符 my_str1 = my_str.lstrip() print( 阅读全文
摘要:
1、split() --分割,返回一个列表, 会丢失分割字符 实例: my_str = 'you and me and he' list01 = my_str.split('and') list02 = my_str.split('and', 1) print(list01) print(list0 阅读全文
摘要:
1. replace() 函数 作用: 替换字符串 语法: replace('需要替换的子串', '新的子串', '替换的次数(可不传)') # 当替换次数不传时,默认全部替换 实例一: mystr = 'you and me and he' new_str1 = mystr.replace('an 阅读全文
摘要:
1、安装wapiti --在命令终端输入 pip install wapiti3 (因为这个结合python使用,所以安装的版本要跟python兼容,因为我的python是3.6版本,所以安装的是wapiti3.0.3版本) 2、安装nikto 如何(不安装的话),执行命令时,会出现提示:本地nik 阅读全文
摘要:
两个方法: 1、常用的方法: 第一种方法是登录后查看网站的 cookie,请求 url 的时候把 cookie 带上(缺点是:cookie有时间限制。优点:简单,方便) 2、添加cookies的方式:思路是:先对比登录前和登录后的cookies区别,查看登录后cookies里那些值是多出来的,然后通 阅读全文