Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4f7f2f commit 603b8caCopy full SHA for 603b8ca
expand/2.py
@@ -0,0 +1,27 @@
1
+#s = raw_input()
2
+#i = 0
3
+#for i in s:
4
+# print i
5
+#raw_input()
6
+
7
+#扩展成在字符串中把特定字符替换成规定字符
8
+import re
9
+def printReplace(srcStr,word):
10
+ for letter in srcStr:
11
+ if letter == word:
12
+ srcStr = srcStr.replace(letter,'!') #字符串不可更改
13
+ return srcStr
14
15
+def printReplace_re(srcStr,word):
16
+ srcStr=re.sub(word,'!',srcStr)
17
18
19
+def main():
20
+ srcStr = raw_input(u"请输入一个字符串:")
21
+ destStr=printReplace_re(srcStr,'i')
22
+ print destStr
23
24
25
+if __name__ == "__main__":
26
+ main()
27
0 commit comments