【python】字符串replace方法替换前n个子串

1 s=“12345112 n=2
3 print(s.replace('1', '*', n))  # *2345*1

猜你喜欢

转载自www.cnblogs.com/vivlalib/p/12544053.html