Python3 isspace()方法

Python 3 教程 · 2019-02-05 22:43:29

描述

Python isspace() 方法检测字符串是否只由空白字符组成。

语法

isspace()方法语法:

str.isspace()

参数

  • 无。

返回值

如果字符串中只包含空格,则返回 True,否则返回 False.

实例

以下实例展示了isspace()方法的实例:

#!/usr/bin/python3

str = "       " 
print (str.isspace())

str = "Codercto example....wow!!!"
print (str.isspace())

以上实例输出结果如下:

True
False

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

Cascading Style Sheets 2.0 Programmer's Reference

Cascading Style Sheets 2.0 Programmer's Reference

Eric A. Meyer / McGraw-Hill Osborne Media / 2001-03-20 / USD 19.99

The most authoritative quick reference available for CSS programmers. This handy resource gives you programming essentials at your fingertips, including all the new tags and features in CSS 2.0. You'l......一起来看看 《Cascading Style Sheets 2.0 Programmer's Reference》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码