I am simply trying to create csv file from lists. Here's the sample code:
import csv
def funcc(data):
with open("sample.csv", "wb") as f:
writer = csv.writer(f)
writer.writerows(data)
if __name__ == "__main__":
data = [['id', 'name', 'score'],
['1', 'john', '2332'],
['2', 'ned', '1213'],
['3', 'rob', '8343']]
funcc(data)
This creates the output but everything is in one column. I tried using csv.writer(f, delimiter=',') and csv.writer(f, dialect='excel'), as mentioned in many SO answers, but nothing seems to work.
Is there something I am missing or not doing right??

csvmodule, using Python's "native" file operations.'wb'not just'w'.