Python isspace()方法

Python 教程 · 2019-02-02 13:28:45

描述

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

语法

isspace()方法语法:

str.isspace()

参数

  • 无。

返回值

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

实例

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

#!/usr/bin/python

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

str = "This is string example....wow!!!";
print str.isspace();

以上实例输出结果如下:

True
False

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

查看所有标签

Elements of Information Theory

Elements of Information Theory

Thomas M. Cover、Joy A. Thomas / Wiley-Blackwell / 2006-7 / GBP 76.50

The latest edition of this classic is updated with new problem sets and material The Second Edition of this fundamental textbook maintains the book's tradition of clear, thought-provoking instr......一起来看看 《Elements of Information Theory》 这本书的介绍吧!

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

RGB HEX 互转工具

html转js在线工具
html转js在线工具

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具