6.21 备忘录 014作业

str1 = '<a href="http://www.fishc.com/dvd" target="_blank">鱼C资源打包</a>'
str2=str1[str1.find("www.fishc.com"):str1.find("/d")]
print(str2)

#备注:
>>> str1 = '<a href="http://www.fishc.com/dvd" target="_blank">鱼C资源打包</a>'
>>> str1.find("www.fishc.com")
16
>>> str1.find("/d")
29

str2=str1[16:29]

# .find() 函数:提取出所需要切片的位置,定在第一个检测点

#拓展:.index() 函数同理

>>> str1 = '<a href="http://www.fishc.com/dvd" target="_blank">鱼C资源打包</a>'
>>> str1.index("w")
16
>>> str1.index("/d")
29

>>> str1 = '<a href="http://www.fishc.com/dvd" target="_blank">鱼C资源打包</a>'
>>> str2 = str1.split('/')
>>> str2
['<a href="http:', '', 'www.fishc.com', 'dvd" target="_blank">鱼C资源打包<', 'a>']
       [0]         [1]       [2]
>>> str1 = '<a href="http://www.fishc.com/dvd" target="_blank">鱼C资源打包</a>'
>>> str1.find("www.fishc.com") - len(str1)
-45
>>> str1.find("/d") - len(str1)
-32

>>> str2=str1[-45:-32]
>>> str2
'www.fishc.com'
a="0123456789"            # 数字
b="qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM" #英文
c=r'~!@#$%^&*()_=-/,.?<>;:[]{}|\''      #特殊字符

d=0                                      
code=input("请输入要检查的密码组合:")
lengh=len(code)
if 0<lengh<=8:
    long=1
elif 8<lengh<16:
    long=2
elif 16<=lengh:
    long=3


for each in code:
    if each in a :
        d+=1
        break
for each in code:
    if each in b:
        d+=1
        break
for each in code:
    if each in c:
        d+=1
        break 

print('您的密码安全级别评定为:',end = ' ')

if d == 1 or long == 1:
    print("低")
    print('''请按以下方式提升您的密码安全级别:  
    1. 密码必须由数字、字母及特殊字符三种组合 
    2. 密码只能由字母开头  
    3. 密码长度不能低于16位''') 
elif d == 2 and long == 2:
    print("中")
    print('''请按以下方式提升您的密码安全级别:  
    1. 密码必须由数字、字母及特殊字符三种组合 
    2. 密码只能由字母开头  
    3. 密码长度不能低于16位''') 
elif d == 3 and long == 3:
    print("高")
    print("请继续保持!")
else:
    print("输入的密码不符合要求")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值