Creating csv file from another file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Creating csv file from another file (/thread-31123.html) |
Creating csv file from another file - pisike - Nov-24-2020 I have a file that is exported from an upstream system and data is not the same in each row. But the main attributes in the file are below. Not all the rows might have all the attributes. unitnumber idnumber givenname manager department city title mobile Contents in the file are as below and can only have the above attributes. i/p: Quote:('uid=test.test51,ou=People,o=ic.com,o=xerox', {'city': ['Irving'], 'title': ['Application Developer'], 'mobile': ['2054444444'], 'manager': ['test.test100'], 'idnumber': ['44451'], 'department': ['National Claims'], 'mail': ['[email protected]'], 'givenname': ['Test1'], 'unitnumber': ['551']}) I need to create a csv file from this that has the data in the below format required o/p: 1st line with header that can be static followed by the data from the above file. Quote:unitnumber,idnumber,mail,givenname,manager,department,city,title,mobile Any help is appreciated |