Reading CSV test data
QuizEasy-MediumPython onlyAsked in: Infosys
CSV means comma-separated values: a text file where each line is a row. data.csv holds:
name,role
Asha,admin
"Ravi, Jr",viewerWhich statements are true? Pick all that apply.
csv.DictReadergives{'name': 'Ravi, Jr', 'role': 'viewer'}for the last rowline.split(",")on the last line gives two fields- The file should be opened with
newline=""for the csv module - Every value read by the csv module is a string
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.