分析
数字中经常是3个数字一组,之后跟一个逗号,因此规律为:***,***,***
正则式复制代码 代码如下:[a-z]+,[a-z]?
复制代码 代码如下:import re
sen = “abc,123,456,789,mnp”p = re.compile(“\d+,\d+?”)
for com in p.finditer(sen): mm = com.group() print “hi:”, mm print “sen_before:”, sen sen = sen
python 判断三个数字中的最大值,具体代码如下所示:
#判断三个数中最大值
n1= int(input('please enter the firest number:'))
n2 = int(input('please enter the second number:'))
n3 = int(input('please enter the third number:'))
max_num = 0
if n1 > n2:
max_num = n1
if n1 > n3:
接下来拆分这一串字符串,每个字符插入一个表变量中,最后使用GROUP BY进行分组。 代码如下: CalNumOfChtInStr SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO — ============================================= — Author: Insus.NET — Create date: 2012-02-23 — Descr iption: Calculate the number of