#!/usr/bin/env python #有如下值集合[11,22,33,44,55,66,77,88,99,90...],将所有大于66值保存至字典的一个key中,将小于66的值保存至大二个key的值 li = [11,22,33,44,55,66,77,88,99,90] person = {">66":[],"<=66":[]} for i,j in enumerate(li,0) : if int(j) > 66 : person[&q
Java ascii码值转为输出ascii码 public static void main(String[] args) { // TODO Auto-generated method stub String a = "\001"; if("\001".equals(a)){ a = "001"; int b = Integer.valueOf(a); //转为ascii char c = (char)b; //转为String String
add by zhj: 在Python文档中清楚的说明了默认参数是怎么工作的,如下 "Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that the same “pre-computed” value is used
Python 获取MD5加密值方法封装 import hashlib def get_md5(s): """获取MD5加密值 :param s: 需要加密的字符串 :return: 密文 """ if s: m = hashlib.md5() if s is str: m.update(s.encode("UTF-8")) else: m.update(str(s).encode("UTF-8")) ret
Python 字符串——巧取值和列表——巧取值 对比 1.字符串取值实例: samp_string = "Whatever you are, be a good one." for i in samp_string: print(i) ,len(samp_string)-,): print(samp_string[i]+samp_string[i+]) print('A=',ord("A")) print()) print('桃:',ord("桃"