Python: 常用list, string处理功能

#1. keep strings in double quote as one word when split string to words

#e.g. str = ‘a b "is si" d ’
#to
#['a','b','is si','d']

#use shlex module
import shlex
words = shlex.split(line)
#2. join string list with delimitor
#e.g. li = ['a', 'b','c']  join to A_B_C.

'_'.join( [ x.upper() for x in li ] )
#3. list的长度..
len(xxlist)
原文地址:https://www.cnblogs.com/hellohelloworld/p/5110187.html