ענת מאירה
0546515015
2016-07-25
בוטוקס ועיבוי שפתיים.
מחמוד אבו חב
0505178463
2016-07-25
מתעניין בעורך דין לכל מטרה.
אנעאם אבו חב
0542969636
2016-07-25
מתעניין בעורך דין לכל מטרה.
this is an output got from python scrapping I want to store it into excel/csv file, such as each row contain 4 columns
for example
+-------------------------------------------------------+
| col 1 | col 2 | col 3 | col 4 |
|בוטוקס ועיבוי שפתיים|0546515015|2016-07-25"|ענת מאירה|
+------------------------------------------------------+
how can I achieve it..? Please Help... Thanks in Advance :)
you could just do this on commandline
This will put all the data in a csv file which can then be read by excel
Ok so you can use openpyxl.
This is one way to proceed. I assume that each line of output that you have is stored as a variable or something. Maybe something like this and you loop through it:
So to get each of those variables written to a spreadsheet you could do something like this:
This type of thing could be implemented in a loop and you could iterate through the row number to fill the sheet with the data that you want. For more help check out This Link.
Start here - https://docs.python.org/3.5/library/csv.html. This is standard library for writing
csv
files. For Excel files you can tryopenpyxl
, which have to be installed separately.