1.最简单的内置format函数: >>> format(1234567890,',') '1,234,567,890' 2.正则表达式: import re def formatNum(num): num=str(num) pattern=r'(\d+)(\d{3})((,\d{3})*)' while True: num,count=re.subn(pattern,r'\1,\2\3',num) if count==0: break return num if __name__=='
python中print输出一行,如果想多次输出的内容不换行,可以在print后面加逗号 例如 每个输出一行 phrase = "abcdefg" # Add your for loop for char in phrase: print char a b c d e f g 输出在同一行 phrase = "A bird in the hand..." # Add your for loop for char in phrase: if(char == "
mysql数字加减科学计数法 这两天因为需求,需要获取一张表的流水号.规则是这样的.当前日期+8位流水号.比如:2015062400000001,2015062400000002,2015062400000003.... 因为考虑到并发问题,所以解决的方案是:在MySQL写存储过程,逻辑如下: 1.查询表今天流水号的最大主键值:如: SELECT MAX(a.ORDER_ID) from Zhang_Test a where 1=1 and a.order_id LIKE CONCAT('%',