当前位置:网站首页>打卡day05
打卡day05
2022-08-02 05:52:00 【huixiaodezuotian】
"""
Python isdigit() 方法检测字符串是否只由数字组成,只对 0 和 正数有效。
语法:str.isdigit()
参数:无
返回值:如果字符串只包含数字则返回 True 否则返回 False。
"""
str ='123456'
print(str.isdigit())
str = 'Hello,World!'
print(str.isdigit())
str = '-1'
print(str.isdigit())
def is_ip(ip):
num_list = ip.split(".")
for num in num_list:
# igit是数字的意思, isdigit就是判断是否是数字, 0 - 9就是数字
if not num.isdigit() or not 0<= int(num)<=255:
return False
return True
print(is_ip("10.289.122.55"))打印结果:
True
False
False
False
边栏推荐
猜你喜欢

rhce homework

node安装及环境配置

MySQL经典50道练习题及全网最详细解析

MySQL高级学习笔记

Nacos安装详细过程

Write implicit join on view with jOOQ 3.14 synthetic foreign key

MySQL联合查询(多表查询)

Technology empowers Lhasa's "lungs", Huawei helps Lalu Wetland Smart Management to protect lucid waters and lush mountains

股价屡创新低 地产SaaS巨头陷入困境 明源云该如何转型自救?

推出 Space On-Premises (本地部署版) Beta 版!
随机推荐
Nacos database configuration
Nacos安装详细过程
MySQL高级-MVCC(超详细整理)
In-depth analysis of the initialization of member variables and local variables
nodejs的安装和全局配置(超详细哦)
oracle 远程连接数据库
HCIP 第三天实验
MySQL union query (multi-table query)
NPM ---- 安装yarn
MySQL (3)
MySQL驱动jar包的下载--保姆教程
mysql高阶语句(一)
npm does not recognize the "npm" item as the name of a cmdlet, function, script file, or runnable program.Please check the spelling of the name, and if the path is included, make sure the path is corr
C语言操作符详解(2)
node安装和配置(node-v12.20.2-x64 ) 以及node版本切换介绍
APP专项测试:流量测试
Nodejs installation and global configuration (super detailed)
代码编世界 科技创未来
leetcode solves the linked list merge problem in one step
Nacos注册中心的部署与用法详细介绍