I've been tasked with making a program that uses information from a CSV file and extracts the year a student joined the school, the first three letters of the first name and the first two letters of the surname.
This is my current code:
names = []
with open('Spreadsheet2.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
names.append(row)
print(names)
Sample Output would be:
`[['John', 'Doe', '2018'], ['Edward', 'Kaizak', '2014'],
['Elizabeth', 'Dezir', '2013'], ['Jack', 'Wilder', '2014'],
['Lily', 'Rais', '2015'], ['Ken', 'Lowley', '2015'],
['Edna', 'Bores', '2015'], ['Jacqueline', 'Keis', '2016'],
['Tammy', 'Howst', '2017']]`
I need to write the extracted data to a new CSV file.
Any help is appreciated.