标签:test 提示 war and 位置 eve 程序 ash 失败
# 打印每个o出现的位置 str1 = "hellopythonhelloworld" str2 = ‘hellopythonhelloworld‘ str3 = ‘hellopythonhelloworl‘ index = 0 for i in str1: if i == ‘o‘: print(index, end=‘\t‘) index += 1 # 枚举实现 str1 = ‘hellopythonhelloworl‘ for i, j in enumerate(list(str1)): if j == ‘o‘: print(i)
# # 实现用户登录校验功能 # # 要求:分别提示用户输入用户名和密码,当用户名为seven,密码为123或用户名为alex密码为456时,显示登陆成功,并结束程序;否则显示登陆失败并提示用户重新输入用户名和密码. # # PS:用户只有3次登录校验的机会,第3次登录失败则结束程序。 # names = [‘alex‘, ‘seven‘] passwords = [‘123‘, ‘456‘] count = 1 while True: name = input(‘your name:‘) password = input(‘your password:‘) if name in names and password in passwords: print(‘wellcome log in‘) break else: print(‘fail to log please try again‘) count += 1 if count > 3: break
# 编写函数,实现接收一个字符串,分别统计大写字母、小写字母、数字字符的个数。 str_a = "Java324javaajlsdf56sdfja54@vajav345aa234ddsfa987dsjkp132132jp324" count_number = 0 count_lower = 0 count_upper = 0 for i in range(0, len(str_a)): if str_a[i].isdigit(): count_number += 1 if str_a[i].islower(): count_lower += 1 if str_a[i].isupper(): count_upper += 1 print(‘数字有%d个‘ % (count_number)) print(‘小写字母有%d个‘ % (count_lower)) print(‘大写字母有%d个‘ % (count_upper))
import re li = [‘https://cashiertest.senguo.me/api/warehouse/createpurchaseorder:{"eta":"2020-11-07","purchase_order_goods_list":[{"goods_id":31345,"goods_name":"goods_01","supplier_id":768,"supplier_name":"默认供货商","amount":3,"price":0,"subtotal":0,"remarks":"","purchase_unit_ratio":1,"purchase_unit_id":2}],"confirm":true}‘, ‘https://cashiertest.senguo.me/api/warehouse/getgoodslastpurchase:{"goods_id":31345}‘, ‘https://cashiertest.senguo.me/api/warehouse/getshopsupplierdetail:{"supplier_id":768,"page":1,"limit":20}‘, ‘https://cashiertest.senguo.me/api/warehouse/editsupplier:{"supplier_id":768,"name":"绝对不要删","phone":"213213213"}‘, ‘https://cashiertest.senguo.me/api/warehouse/createsupplier:{"name":"supply_01","phone":"23424234"}‘] ex = ‘https‘ for match in re.finditer(ex, str(li)): print("match found from {} to {}".format(match.start(), match.end()))
标签:test 提示 war and 位置 eve 程序 ash 失败
原文地址:https://www.cnblogs.com/teark/p/14527727.html