#!/usr/bin/env python # coding=utf-8 str1 = "abcdefabcdefgghj" listStr = [] for eachStr in str1: countStr = str1.count(eachStr) numStr = eachStr + ":" + str(countStr) if numStr not in listStr : listStr.append(numStr) for i in listStr: print i
时间: 2025-01-03 02:53:56