日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)Python教程:Pythonisspace()

python 中的isspace()函數(shù)有助于檢查字符串中的所有字符是否都是空白字符。如果字符串中充滿空白字符(制表符、空格、換行符等),則該函數(shù)返回 true。)否則返回 false。

 **string.isspace()** 

isspace()參數(shù):

isspace()方法不接受任何參數(shù)。

isspace()返回值

返回值始終是布爾值。如果字符串為空,函數(shù)返回假。

| 投入 | 返回值 | | 所有空白字符 | 真實(shí)的 | | 至少一個(gè)非空白字符 | 錯(cuò)誤的 |

Python 中isspace()方法的示例

示例isspace()在 Python 中是如何工作的?

 string = '   \t'
print(string.isspace())

string = ' a '
print(string.isspace())

string = ''
print(string.isspace()) 

輸出:

 True
False
False 

示例 2:如何在 Python 中使用isspace()?

 string = '\t  \n'
if string.isspace() == True:
  print('String full of whitespace characters')
else:
  print('String contains non-whitespace characters')

string = '15+3 = 18'

if string.isspace() == True:
  print('String full of whitespace characters')
else:
  print('String contains non-whitespace characters.') 

輸出:

 String full of whitespace characters
String contains non-whitespace characters 

分享題目:創(chuàng)新互聯(lián)Python教程:Pythonisspace()
文章轉(zhuǎn)載:http://www.5511xx.com/article/ccicece.html