Python中split(‘,‘)的用法

 遇到的代码:

opt_over_list = opt_over.split(',')

搜索到的只有split()和split(‘ ‘)的用法

So....自己试最好

article = '''This is a photograph
here is a boy
she is queen'''
print(article.split(','))
['This is a photograph\nhere is a boy\nshe is queen']


print(article.split(' '))
['This', 'is', 'a', 'photograph\nhere', 'is', 'a', 'boy\nshe', 'is', 'queen']


print(article.split())
['This', 'is', 'a', 'photograph', 'here', 'is', 'a', 'boy', 'she', 'is', 'queen']

你可能感兴趣的:(python)