【说站】python中isprintable判断字符的使用
2025-01-05
34
python中isprintable判断字符的使用
说明
1、判断字符是否为可打印字符。isprintable()用于判断字符串中的所有字符是否为空。
Unicode字符集中在Other和Separator类别中的字符是不可打印的字符(但不包括ASCII码中的空格(0x20)。
2、isprintable()可以用来判断转义字符。
实例
str1 = '\n\t' print(str1.isprintable()) # False str1 = 'mr_soft' print(str1.isprintable()) # True str1 = '12345' print(str1.isprintable()) # True str1 = '蜘蛛侠' print(str1.isprintable()) # True
以上就是python中isprintable判断字符的使用,希望对大家有所帮助。更多Python学习指路:python基础教程
本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。
更新于:16天前赞一波!
相关文章
- 【说站】Python kmeans聚类的使用
- 【说站】Python中concurrent.futures模块如何使用
- 【说站】Python curses库如何使用
- 【说站】Python字典常用方法汇总
- 【说站】Python字符串方法如何使用
- 【说站】Python列表操作方法的整理
- 【说站】Python中os模块的功能介绍
- 【说站】python模块的搜索顺序分析
- 【说站】python抛出raise异常的注意点
- 【说站】Python psd-tools如何转换文件
- 【说站】python异常的传递
- 【说站】python自定义日志如何实现
- 【说站】python有哪些注释的种类
- 【说站】python中__new__的重写
- 【说站】python如何解决初始化执行次数
- 【说站】python错误类型捕获的方法
- 【说站】python数据结构堆的介绍
- 【说站】python参数调用的注意点
- 【说站】python Pandas读取数据文件的优点
- 【说站】python中in和is的区分
文章评论
评论问答