- 博客(5)
- 收藏
- 关注
原创 生成随机的账号或者密码
平时经常要用到一些测试的数据.无论是插入数据库还是写入到文本中.都需要一些模拟的数据.下面就写了一个专门生成随机的字符.可以做用生成账号或者密码.直接上代码import randomdef random_characters(num, digits): """ 生成随机的字符.此方法可以用于生成账号和密码 :param num:生成字符的个数 :param digits:生成字符的位数 :return:无 """ random.se
2021-11-30 11:06:20
2604
原创 python 得到List中最小(最大)的数-算法
""" 计算出列表中最小的数"""def f_calculate_min(list_target): min_value = list_target[0] for i in range(1, len(list_target)): if min_value > list_target[i]: min_value = list_target[i] return min_value调用:list01 = [88,.
2021-09-13 19:19:30
383
原创 python 算法-累计乘法
""" 函数 数值累乘 调用:实参不限个数"""def f_cumulative_multiplication(*args): result = 1 for index in range(len(args)): result *= args[index] return result调用:print(f"结果是:{f_cumulative_multiplication(5, 6, 8)}")累计乘法其实和累.
2021-09-13 11:37:06
2419
1
原创 python list列表排序算法 降序排列(由大-->到小)
""" list排序算法.降序排列 由大-->到小"""def sort_list_big(list_new): """ list排序算法.降序排列 :param list_new:列表形参 :return: """ for r in range(len(list_new) - 1): # 作对比 for i in range(r + 1, len(list_new)): .
2021-09-12 12:12:07
3000
原创 python 字典排序法-->升序排列
都知道,python直接排序字典是没有办法排序的。那么可以将它变成List来排序。def arrangement_ascending(dict_target): list_k_y = list(dict_target.items()) for r in range(len(list_k_y) - 1): for c in range(r + 1, len(list_k_y)): if list_k_y[r][1] > list_k_y[
2021-09-12 12:00:01
1822
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人