csv - How to delete a string in a loop with Python? -
i have got text in format:
"text1";" text2";"text3";"text4";"text5 ";"";"text6" "text7";" text8";"text9";"text10";"text11";"";"text12"
i used web-scraping , want delete empty string --> [5]. how can in loop? code:
for record in table.find_all('tr', class_="mytable"): temp_data = [] data in record.find_all("td"): temp_data.append(data.text.encode('latin-1')) datatable.append(temp_data) #how can delete [5] here?
if want remove empty string can use this,
newlist = filter(none, oldlist)
Comments
Post a Comment