当前位置:网站首页>punch day05
punch day05
2022-08-02 07:11:00 【huixiaodezuotian】
"""The Python isdigit() method checks if a string consists of digits only, valid only for 0 and positive numbers.Syntax: str.isdigit()Parameters: noneReturn Value: Returns True if the string contains only numbers otherwise returns 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 means number, isdigit is to judge whether it is a number, 0 - 9 is a numberif not num.isdigit() or not 0<= int(num)<=255:return Falsereturn Trueprint(is_ip("10.289.122.55"))
Print result:
True
False
False
False
边栏推荐
- 股价屡创新低 地产SaaS巨头陷入困境 明源云该如何转型自救?
- .NET静态代码织入——肉夹馍(Rougamo) 发布1.1.0
- MySQL classic 50 practice questions and the most detailed analysis of the whole network
- Py之mlxtend:mlxtend库的简介、安装、使用方法之详细攻略
- zabbix auto-discovery and auto-registration
- PHP Warning: putenv() has been disabled for security reasons in phar
- MySql统计函数COUNT详解
- 暑期总结(三)
- 代码编世界 科技创未来
- MySQL Advanced Study Notes
猜你喜欢
Xgboost报错ValueError:无效的形状:标签(1650 2)
aTrust项目的相关操作与分享
Not annotated parameter overrides @NonNullApi parameter
View source and switch mirrors in two ways: npm and nrm
宝塔+FastAdmin 404 Not Found
MySQL 5.7 installation tutorial (full-step, nanny-level tutorial)
MySQL Advanced Statements (1)
人工神经网络
GCC编译器技术解析
typescript ‘props‘ is declared but its value is never read 解决办法
随机推荐
MySQL经典50道练习题及全网最详细解析
Not annotated parameter overrides @NonNullApi parameter
Py之mlxtend:mlxtend库的简介、安装、使用方法之详细攻略
MySQL - 多表查询与案例详解
股价屡创新低 地产SaaS巨头陷入困境 明源云该如何转型自救?
Nodejs installation and global configuration (super detailed)
go里面的基本知识
Technology empowers Lhasa's "lungs", Huawei helps Lalu Wetland Smart Management to protect lucid waters and lush mountains
MarkDown公式指导手册
C# 编码规范手册
提交代码流程
Go inside the basic knowledge
zabbix自动发现和自动注册
Toolbox App 1.25 New Features at a Glance | Version Update
HCIP 第四天
pointer arithmetic in c language
C# FileInfo类
zabbix email alarm and WeChat alarm
MySQL联合查询(多表查询)
aTrust项目的相关操作与分享