I have been tasked with taking data from two csv's combining them and then inserting them into a database. The code to insert into the database work's fine, but it uses the header of the csv and matches it to columns in the database. Essentially I need to take a list of the columns and the database and a list of the headers in the csvs and generate a a new csv that that takes the data from the old csvs and put the new headers onto the merged csv(note that there is also some logic performed, such as combining columns, so it is not just a merge). I am wondering if there is a way to simultaneously declare class variables and put them into a list, while leaving other class variables outside of the list. This would make it easier to insert the new header to the new csv. I want something like the following:
class MyClass():
HEADER_FOR_NEW_CSV=[
HEADER_VALUE_THAT_IS_ALSO_A_CLASS_VARIABLE="",
ANOTHER_CLASS_VARIABLE=""
]
CSV_INPUT_FILE_NAME=""
OTHER_CLASS_VARIABLES=""
HEADER_FROM_INPUT_CSV=[
MORE_CLASS_VARIABLES=""
]
Is there a way to do this? If not is there a better way to organise my data? Or should I just declare my header variables and then make a list of them afterward?