本文基于Stackoverflows上以下几个Question: Fastest way to remove chars from string (http://stackoverflow.com/questions/2182459/fastest-way-to-remove-chars-from-string) More efficient way to remove special characters from string (http://stackoverflow.com/questi…
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…