Discuss / Python / 错误处理

错误处理

Topic source
def str2num(s):
   try:
      return int(s)
   except ValueError:
      return float(s)

  • 1

Reply