当前位置:网站首页>打卡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
边栏推荐
猜你喜欢
mysql索引失效的常见9种原因详解
node安装和配置(node-v12.20.2-x64 ) 以及node版本切换介绍
MySQL driver jar package download -- nanny tutorial
Nacos注册中心的部署与用法详细介绍
Kingdee International: Lost in half a year and last year, how does the business model of frantically burning money continue
node安装及环境变量配置
Analysis of port 9848 error at startup of Nacos client (non-version upgrade problem)
路由规划中级篇
Nacos installation configuration and single-machine deployment tutorial
Launch Space on-premises deployment (local) Beta!
随机推荐
能与观众实时互动的Claper
zabbix邮件报警和微信报警
Leetcode周赛304
MySQL高级-MVCC(超详细整理)
[Cartoon] 2021 full score programmer behavior comparison table (latest version)
MySQL Advanced SQL Statements (2)
DNS的解析流程
MySQL(3)
HCIP第十七天
Launch Space on-premises deployment (local) Beta!
Leetcode parentheses matching problem -- 32. The longest parentheses effectively
npm 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
有人开源全凭“为爱发电”,有人却用开源“搞到了钱”
物联网如何改变城市运行效率
rhce homework
zabbix email alarm and WeChat alarm
Py之mlxtend:mlxtend库的简介、安装、使用方法之详细攻略
MySQL高级SQL语句(二)
Toolbox App 1.25 New Features at a Glance | Version Update
Kingdee International: Lost in half a year and last year, how does the business model of frantically burning money continue