当前位置:网站首页>打卡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
边栏推荐
- APT + Transform to realize multi module Application distributed Application life cycle
- mysql索引失效的常见9种原因详解
- Common functions of pytorch
- C语言操作符详解(2)
- HCIP第十七天
- A detailed introduction to the deployment and usage of the Nacos registry
- leetcode solves the linked list merge problem in one step
- DNS的解析流程
- 深入剖析成员变量和局部变量的初始化问题
- Dataset:机器学习中常用数据集下载链接集合之详细攻略
猜你喜欢
随机推荐
oracle 远程连接数据库
专家见解|经济低迷期把握创新机会的 3 大方法
有点奇怪!访问目的网址,主机能容器却不行
Py之mlxtend:mlxtend库的简介、安装、使用方法之详细攻略
npm、nrm两种方式查看源和切换镜像
MySQL Advanced SQL Statements
Technology empowers Lhasa's "lungs", Huawei helps Lalu Wetland Smart Management to protect lucid waters and lush mountains
rhce homework
nodejs的安装和全局配置(超详细哦)
The installation of NPM, CNPM
MySQL Advanced - MVCC (ultra-detailed finishing)
HCIP BGP综合实验 建立对等体、路由反射器、联邦、路由宣告及聚合
Thread Basics (1)
C# FileInfo类
go里面的基本知识
HCIP 第三天实验
MySQL - Multi-table query and case detailed explanation
Reverse resolve dns server
zabbix自动发现和自动注册
NPM ---- 安装yarn









