当前位置:网站首页>打卡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
边栏推荐
- Not annotated parameter overrides @NonNullApi parameter
- MySQL high-level statements (1)
- HCIP 第三天实验
- Technology empowers Lhasa's "lungs", Huawei helps Lalu Wetland Smart Management to protect lucid waters and lush mountains
- How to install the specified version package with NPM and view the version number
- npm、cnpm的安装
- The advantages of making web3d dynamic product display
- Toolbox App 1.25 New Features at a Glance | Version Update
- 一文搞懂C操作符
- 8/1 思维+扩展欧几里得+树上dp
猜你喜欢
MySQL Advanced Statements (1)
看图就懂|衡量业务增长健康的销售指标如何选择
Technology empowers Lhasa's "lungs", Huawei helps Lalu Wetland Smart Management to protect lucid waters and lush mountains
引领需求 为HR价值正名——“人力资源领先模型HRLM”成功首发
oracle 远程连接数据库
Ant three sides: MQ message loss, duplication, backlog problem, what are the solutions?
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
MySQL 5.7 安装教程(全步骤、保姆级教程)
【21天学习挑战赛】顺序查找
人工神经网络
随机推荐
Go inside the basic knowledge
MySQL经典50道练习题及全网最详细解析
Node installation and environment configuration
go里面的基本知识
Reverse resolve dns server
Tips for programmers to write PPT
postgres 多个变量填充字符串,字串格式化
Nacos注册中心的部署与用法详细介绍
MySQL high-level --- storage engine, index, lock
Nacos database configuration
MySQL Advanced SQL Statements (2)
NPM ---- 安装yarn
一文搞懂C操作符
MySql - there is no insert, there is update or ignored
MySQL - 多表查询与案例详解
Mining game (C language)
专家见解|经济低迷期把握创新机会的 3 大方法
[数据集][VOC]男女数据集voc格式6188张
mysql索引失效的常见9种原因详解
MySQL高级SQL语句(二)