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

查看所有标签

Functional Programming in Scala

Functional Programming in Scala

Paul Chiusano、Rúnar Bjarnason / Softbound print / 2014-9-14 / USD 44.99

Functional programming (FP) is a programming style emphasizing functions that return consistent and predictable results regardless of a program's state. As a result, functional code is easier to test ......一起来看看 《Functional Programming in Scala》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具