今天本来打算写个程序,替换字符串中固定的一个字符:将<全部替换成回车'\n' 于是,我写成这样 s='sdjj<ddd<denj,>' for x in s: if x=='<': x='\n' print(s) 然后输出还是 'sdjj<ddd<denj,>' 然后我就很纳闷,于是乎我又写成了这样 s='sdjj<ddd<denj,>' ss=list(s) for x in ss: if x=='<': x='\n' print(
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
sql server replace的替换字符,replace的使用 select REPLACE(name,'张','') * from entity_5c7a578c05c7042958d91485_goods select REPLACE(列名,'匹配的字符',‘想换成的字符’),* from product