0
我正在開發一個Python腳本,它從日誌文件中獲取數據,我需要將每種類型的數據保存到各自的列中。我正在使用正則表達式來獲取數據。如何將每個列表列表放入python的csv列中?
這是我的代碼的一部分,我得到這樣的結果:
#Getting data from log as list using regex
fecha = re.findall('\d{4}\-\d{2}\-\d{2}', str(listaValores))
hora = re.findall('\d{2}\:\d{2}\:\d{2}', str(listaValores))
#List of lists about data obtained
valoresFinales = [fecha, hora]
#Putting into .csv
with open("resultado.csv", "w") as f:
wr = csv.writer(f, delimiter=';')
wr.writerows(valoresFinales)
我想要什麼
謝謝!!你救了我! – Sergi