write a command line program that takes several csv files as arguments. each csv file (found in the fixtures directory of this repo) will have the same columns. your script should output a new csv file to stdout that contains the rows from each of the inputs along with an additional column that has the filename from which the row came (only the file's basename, not the entire path). use filename as the header for the additional column.

Respuesta :

Using the knowledge in computational language in python it is possible to write a code that command line program that takes several csv files as arguments. each csv file.

Writting the code:

import csv

import hashlib

import os.path as path

import random

DIR = path.abspath(path.dirname(__file__))

FILES = {

   'clothing.csv': ('Blouses', 'Shirts', 'Tanks', 'Cardigans', 'Pants', 'Capris', '"Gingham" Shorts',),

   'accessories.csv': ('Watches', 'Wallets', 'Purses', 'Satchels',),

   'household_cleaners.csv': ('Kitchen Cleaner', 'Bathroom Cleaner',),

}

def write_file(writer, length, categories):

   writer.writerow(['email_hash', 'category'])

   for i in range(0, length):

        ])

def main():

   for fn, categories in FILES.items():

               random.randint(100, 1000),

               categories

           )

if __name__ == '__main__':

   main()

See more about python at brainly.com/question/18502436

#SPJ1

Ver imagen lhmarianateixeira
ACCESS MORE