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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -