luozhongming
import sys,os

def ipcheck(ipstr):
tag=True
bb=ipstr.split(\'.\',4)
if len(ipstr.split(\'.\',4))!=4:
tag=False
print("不是合法的IP地址")
else:
for i in range(len(bb)):
if bb[i].isdigit() != 0 and 0 <= int(bb[i]) <= 255:
if len(bb[i])>1 and bb[i][0]!=0:
tag=False
print("不是合法的IP地址")
else:
tag=True
else:
tag = False
print("不是合法的IP地址2")
sys.exit()
return tag
ipcheck("01.0.1.0")

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2021-12-26
  • 2022-12-23
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-06-06
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
相关资源
相似解决方案