fork download
  1. def f(s):
  2. bs = s.encode()
  3. ba = bytearray()
  4. for b in bs: ba.append(ord(b'*') if b in range(ord('0'), ord('9')) else b)
  5. return bytes(ba).decode()
  6.  
  7. def main():
  8. #ro = open("masking.in", "r")
  9. #wo = open("masking.out", "w")
  10. #s = ro.read()
  11.  
  12. s = "abcd123 zxcv55 1q2w3e4r!@#$"
  13. result = f(s)
  14. print(result)
  15.  
  16. #ro.close()
  17. #wo.close()
  18.  
  19. if __name__ == "__main__":
  20. main()
Success #stdin #stdout 0.04s 9440KB
stdin
Standard input is empty
stdout
abcd*** zxcv** *q*w*e*r!@#$