I want to split a sentence into a list of words.
For English and European languages this is easy, just use split()
>>> \"This is a sentence.
if str longer than 30 then take 27 chars and add '...' at the end otherwise return str
str='中文2018-2020年一区6、8、10、12号楼_「工程建设文档102332号」' result = len(list(str)) >= 30 and ''.join(list(str)[:27]) + '...' or str