本文实例讲述了python每次处理一个字符的三种方法。分享给大家供大家参考。
具体方法如下:
a_string = "abccdea" print 'the first' for c in a_string: print ord(c)+1 print "the second" result = [ord(c)+1 for c in a_string] print result print "the thrid" def do_something(c): return ord(c)+1 result = map(do_something ,a_string) print result
打印出的结果如下:
软件介绍 a.. 当今的市场压力迫使企业在提高产品质量和性能的同时,降低成本和缩短产品上市的时间。每个企业都在努力更新自己,包括其生产过程和产品,以满足这些需求。实现这些目标的三种方法是:业务处理再设计、新技术应用、与顾客形成战略联盟。 b.. 对所有的商业应用只有建立整体的IT体系结构,才能形成战略优势,才能确定企业的突破口。这种新的体系结构是以三层结构标准为基础的客户关系
the first 98 99 100 100 101 102 98 the second [98, 99, 100, 100, 101, 102, 98] the thrid [98, 99, 100, 100, 101, 102, 98]
希望本文所述对大家的Python程序设计有所帮助。









