#Python code:
import csv # first we need import necessary lib:csv
file=open("dinesh.csv") #prepare a csv file for our example
testWriter = csv.writer(open('dinesh.csv', 'w'), delimiter=' ',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamWriter.writerow(['Test'] * 5 + ['Wow'])
Error:-
<type 'exceptions.IOError'>: invalid mode: w
args = ('invalid mode: w',)
errno = None
filename = None
message = 'invalid mode: w'
strerror = None