import string
#UPIRU:6 10:10 13 12:
def getMaxValue(content):
print 'getMaxValue processing '+ content;
splitContent = content.split(' ');
print(splitContent);
maxValue = 0;
for i in splitContent:
if maxValue < i:
maxValue = i;
return maxValue;
def filterMaxString (content):
print 'filterMaxString processing '+ content;
splitContent = content.split(':');
n=0;
for i in splitContent:
maxValue = getMaxValue(i);
print 'maxValue:'+maxValue;
splitContent[n] = maxValue;
n=n+1;
return splitContent;
if __name__ == '__main__':
content = 'UPIRU:6 10:10 13 12:';
splitContent = filterMaxString(content);
print splitContent
for i in splitContent:
print(i);
python 实现固定格式筛选最大值的代码
最新推荐文章于 2023-01-05 11:56:14 发布