随笔分类 - python
python学习
摘要:python 常用开发技巧 列表推导式 >>> chars = [ c for c in 'python' ] >>> chars ['p', 'y', 't', 'h', 'o', 'n'] 字典推导式 >>> dict1 = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e
阅读全文
摘要:python 动态调用方法示例 eval() 函数用来执行一个字符串表达式,并返回表达式的值。 def response(request, def_name): request_method = request.method try: if def_name in ['product_update'
阅读全文
摘要:python 等概率生成随机数方法 ran_list = ['0','1','2','3','4','5','6','7','8','9'] random.shuffle(ran_list) rst = 'N'+(''.join(list(ran_list[:7])))
阅读全文

浙公网安备 33010602011771号