Computers and Technology

Define a function named read_csv_header with one parameter. This parameter will be a csv reader object (e. g., the value returned when calling the function csv. reader). The first row read using the parameter is the file's header row. The header row contains the keys for the data stored in the CSV file. This function must return a list containing the strings from that header row. The function parameter will be a csv reader object and not a string. This means you do not need the with..as nor create the csv reader in your function, but this will be done in the code calling your function. For example, to execute read_csv_header using a file named "smallDataFile. csv" you would write the following code: with open("smallDataFile. csv") as f_in: csv_r = csv. reader(f_in) header = read_csv_header(csv_r) You would then want to include code to check that header had the expected value. For example, suppose the first line of the file being read by csv_r was: tow_date, tow_reason then the call read_csv_header(csv_r) would need to return: ['tow_date','tow_reason'].

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 07:30, DivineMemes420
What type of computer network ensures high security ?
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, araminaara691
How can a user open a blank presentation? 1.on the file menu, click new, and then click recent templates 2.on the file menu, click new, and then click blank presentation 3. on the view menu, click templates, and then click recent templates 4. on the view menu, click samples, and then click blank presentation
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, hmontalvo22
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
image
Computers and Technology, 23.06.2019 09:00, jeremytheprimerapper
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
Do you know the correct answer?
Define a function named read_csv_header with one parameter. This parameter will be a csv reader obje...

Questions in other subjects:

Konu
Mathematics, 04.11.2020 20:10
Konu
Business, 04.11.2020 20:10