Home > front end >  Can't Write Into Multiple Columns CSV
Can't Write Into Multiple Columns CSV

Time:08-12

I know there are similar questions, but none worked for me. I'm trying to insert a list of lists into a csv file ... I need each list in the list to be inserted in a row and each item in that list in different columns.

here is the code :

all_list = [job_titles_list, company_list, locations_list, skills_list]
ziped = zip_longest(*all_list)

with open('jobs.csv', 'w') as file:
    writer = csv.writer(file)
    writer.writerow(["Job Title;Company Name;Location;Skills;salary"])
    writer.writerows(ziped)
    file.close()

it show like this :

| Job Titles                        | company name| Salary|

|senior programmer, Google, 100000  |

|python programmer, Netflix, 200000 |

All the data in one column.

I hope you get what I mean.

CodePudding user response:

It looks like the header row you write is just a string

writer.writerow(["Job Title;Company Name;Location;Skills;salary"])

By default, enter image description here

CodePudding user response:

(replying to @danPho )

It wrote it all in one column This what it shows me

  • Related