简体   繁体   中英

Why isalpha() doesn't work?

Python 3.4.3

I'm reading data from Excel-file via openpyxl . E18 cell contains text 'переход'.

from openpyxl import load_workbook

wb = load_workbook(filename='data.xlsx', read_only=True)
ws = wb.active
data = ws['E18'].value
print(data.isalpha())

Why it print False?

I created a similar spreadsheet with these values:

переход
'переход'
abc
'

It prints for each of the above respectively:

True
False
True
False

Does you data contain the ' character which is not alpha and therefor you get False?

print ("'".isalpha())
False
print ("переход".isalpha())
True
print ("'переход'".isalpha())
False

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM