我用这个代码:如何分割多字符串数组
from bs4 import BeautifulSoup
parser = BeautifulSoup(remote_data)
parse_data = parser.find_all('a')
for atag_data in parse_data:
URL_list = atag_data.get('href')
当我尝试URL_LIST分成数组:
array = str.split(URL_list)
我给这3个数组:
['index1.html']
['example.exe']
['document.doc']
但我只需要一个像这样的数组:
['index1.html','example.exe','document.doc']
有什么建议吗?
请您输入的样品添加到您的问题。 – 2012-11-09 11:24:05
你为什么试图再次分裂?它应该已经是一个列表(数组在Python中称为列表)。 – redShadow
不管怎么说,要分割一个字符串,你要做''yourstring.split(separator)'',那''str.split(yourlist)''对我来说没什么意义.. – redShadow