Something like: import csv in_csv=csv.reader( file('your INPUT filenamehere.csv') ) out_csv=csv.writer( file('your OUPUT filenamehere.csv','wb') ) ## If you have a header record on your input file, then out_csv.writerow( in_csv.next() ) ## Iterate over your input file for row in in_csv: # Row will be a list where row[0]=userid and row[3]=passwd password=some_function_as_advised_by_rest_of_group() # Assuming you want to write password as new field then out_csv.writerow( row + [password] ) # Assuming you want to over-write password field then row[3] = password out_csv.writerow(row)
All the best, Jon. k.i.n.g. wrote: > Hi ALL, > > I am sorry for not mentioning that I am new to python and scripting. > How can I add the above script to handle csv file. I want the script to > generate passwords in the passwords column/row in a csv file. > > userid,realname,dateofB,passwd > > The script should read the userid and genrate the password for each > user id (there are thousands of userids) > > Kanthi -- http://mail.python.org/mailman/listinfo/python-list