添加Kama54.替换数字的Python版本
This commit is contained in:
parent
3d26c1e313
commit
5d56461d39
|
|
@ -235,7 +235,15 @@ func main(){
|
||||||
|
|
||||||
|
|
||||||
### python:
|
### python:
|
||||||
|
```Python
|
||||||
|
class Solution:
|
||||||
|
def change(self, s):
|
||||||
|
lst = list(s) # Python里面的string也是不可改的,所以也是需要额外空间的。空间复杂度:O(n)。
|
||||||
|
for i in range(len(lst)):
|
||||||
|
if lst[i].isdigit():
|
||||||
|
lst[i] = "number"
|
||||||
|
return ''.join(lst)
|
||||||
|
```
|
||||||
### JavaScript:
|
### JavaScript:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue