当前位置:网站首页>打卡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
边栏推荐
- Nacos database configuration
- APT + Transform to realize multi module Application distributed Application life cycle
- mysql索引失效的常见9种原因详解
- NPM 安装指定版本包的方法及版本号查看
- Leading the demand and justifying the HR value - the successful launch of the "Human Resource Leading Model HRLM"
- MySQL classic 50 practice questions and the most detailed analysis of the whole network
- nacos安装配置和单机部署教程
- Thread Basics (1)
- 有点奇怪!访问目的网址,主机能容器却不行
- MySql COUNT statistics function explanation
猜你喜欢

aTrust项目的相关操作与分享

leetcode solves the linked list merge problem in one step

zabbix auto-discovery and auto-registration

Practice on optimizing startup performance of VS Code

Detailed explanation of 9 common reasons for MySQL index failure

zabbix邮件报警和微信报警

Not annotated parameter overrides @NonNullApi parameter

Node installation and configuration (node-v12.20.2-x64 ) and introduction to node version switching

MySQL高阶---存储引擎、索引、锁

Nacos安装详细过程
随机推荐
pointer arithmetic in c language
反向解析dns服务器
leetcode-338.比特位计数
专家见解|经济低迷期把握创新机会的 3 大方法
Leetcode周赛304
Toolbox App 1.25 New Features at a Glance | Version Update
Tips for programmers to write PPT
selenium + robotframework的运行原理
Machine learning -- - theory of support vector machine (SVM)
Node installation and configuration (node-v12.20.2-x64 ) and introduction to node version switching
APP专项测试:流量测试
node安装及环境变量配置
Node installation and environment configuration
Practice on optimizing startup performance of VS Code
Write implicit join on view with jOOQ 3.14 synthetic foreign key
MySql 5.7.38下载安装教程 ,并实现在Navicat操作MySql
Leading the demand and justifying the HR value - the successful launch of the "Human Resource Leading Model HRLM"
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 Advanced SQL Statements
Double for loop case (use js jiujiu printing multiplication table)