working with csv files csv writer (csvfiledialect='excel'**fmtparamsreturns writer object responsible for converting the user' data into delimited strings on the given csvfile an optional dialect parameter provided the fmtparams keyword arguments can be given to override individual formatting parameters in the current dialect csv list_dialects(return the names of all registered dialects for example on mac os the default list of dialects is ['excel''excel-tab''unix'the csv writer class csv writer is obtained from the csv writer(function the csvwriter supports two methods used to write data to the csv filecsvwriter writerow(rowwrite the row parameter to the writer' file objectformatted according to the current dialect csvwriter writerows(rowswrite all elements in rows (an iterable of row objects as described aboveto the writer' file objectformatted according to the current dialect writer objects also have the following public attributecsvwriter dialect read-only description of the dialect in use by the writer the following program illustrates simple use of the csv module which creates file called sample csv as we have not specified dialectthe default 'exceldialect will be used the writerow(method is used to write each comma separate list of strings to the csv file print('crearting csv file'with open('sample csv'' 'newline=''as csvfilewriter csv writer(csvfilewriter writerow(['she loves you''sept ']writer writerow([' want to hold your hand''dec ']writer writerow(['cant buy me love''apr ']writer writerow([' hard days night''july ']the resulting file can be viewed as shown below