added = ['hypr1005.ops.colo.cmp.com,web1234.ads.colo.cmp.com,876543,4']
上面的变量是一个列表,它包含由逗号分隔的单个值,我只想使用逗号分割值并创建一个看起来像的列表
added = ['hypr1005.ops.colo.cmp.com','web1234.ads.colo.cmp.com','876543','4']
words = added.split(',')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'split'
Guess split 仅适用于不在列表中的字符串,那么我该怎么做呢?