QGB / QPSU

QGB's Python Simplified Utils
MIT License
4 stars 3 forks source link

T #11

Open QGB opened 4 years ago

QGB commented 4 years ago

输出列表时,最好 数字 在前,不确定长度的长文本最后,方便格式化

QGB commented 4 years ago

T.tab T.space

QGB commented 3 years ago
-------> U.len(lba,de,T.charset)
Out[92]: [98, 22, 120]

In [93]: [i for i in lba if i[1]!=32]
Out[93]:
[[unicode-internal      , 33,   !"#$%&'()*+,-./:;<=>?@[\]^`{|}~],
 [utf-16-le             , 33,   !"#$%&'()*+,-./:;<=>?@[\]^`{|}~],
 [utf-16-be             , 33,   !"#$%&'()*+,-./:;<=>?@[\]^`{|}~],
 [utf-7                 , 30,  !"#$%&'()*+,-./:;<=>?@[]^`{|}],
 [utf-32-le             , 33,   !"#$%&'()*+,-./:;<=>?@[\]^`{|}~],
 [utf-32-be             , 33,   !"#$%&'()*+,-./:;<=>?@[\]^`{|}~]]

In [109]: dt={}
     ...: de={}
     ...: lt=[]
     ...: le=[]
     ...: for c in T.gcharset:
     ...:     try:
     ...:         dt[c]=b.decode(c)
     ...:         lt.append([c,b.decode(c)] )
     ...:     except Exception as e:
     ...:         de[c]=e
     ...:         le.append([c,e])
     ...:
     ...:
C:\QGB\Anaconda3\Scripts\ipython:7: DeprecationWarning: unicode_internal codec has been deprecated

In [110]: U.len(lt,le)
Out[110]: [58, 62]