Generation

generate functionMon, 05 Dec 2022

copy a column from a files using a for loop

def copy_column(file_name, column_number): data = [] with open(file_name) as f: for line in f: row = line.split(',') data.append(row[column_number]) return data

Questions about programming?Chat with your personal AI assistant