[英]reading .xls files with xlrd
When reading data from excel tables with an xlrd package, the output often has a prefix u' or something similiar (like, in one case, it had a \– instead of a '-' character). 当使用xlrd包从excel表中读取数据时,输出通常带有前缀u'或类似的字符(例如,在一种情况下,它带有\\ u2013而不是'-'字符)。 Why is this and which are the characters i need to look out for, as I'm going to have to parse some information from the spreadsheet cells.
为什么要这样做,以及我需要注意哪些字符,因为我将不得不解析电子表格单元格中的一些信息。
Here's an example: 这是一个例子:
>>> wb = xlrd.open_workbook('tellimusleht.xls')
>>> sh = wb.sheet_by_index(0).row_values(5)
[2.0, u'aken sisseavanev, pakett, aluliist, ilma petekata parem', 552.0, 1729.0, 2.0, u'Sp.Barbados 4*6 \u2013 1 maja ']
Thank you for your help! 谢谢您的帮助!
The u
denotes a unicode string . u
表示一个unicode字符串 。 \–
is the Unicode EN DASH character , which is displayed as –
, but it isn't the same as a regular dash: \–
是Unicode EN DASH字符 ,显示为–
,但与常规破折号不同:
–
- # Notice how one is longer than the other
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.