We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff77e37 commit bbdd308Copy full SHA for bbdd308
1 file changed
newcodes/answers/q70.py
@@ -0,0 +1,17 @@
1
+#!/usr/bin/env python
2
+# coding=utf-8
3
+
4
+class Keeper:
5
+ def __init__(self, keep):
6
+ self.keep = keep
7
+ def __getitem__(self, s):
8
+ if s not in self.keep:
9
+ return None
10
+ return s
11
+ def __call__(self, s):
12
+ return s.translate(self)
13
14
+if __name__ == "__main__":
15
+ mf = Keeper
16
+ cang = mf('canglaoshi')
17
+ print(cang("what is your name? my name is laoshicang"))
0 commit comments