csv module need to be imported in a Python program to invoke or use the…
2023
csv module need to be imported in a Python program to invoke or use the function:
Answer: B. writerow() / writerow() — The csv module must be imported in a Python program to use functions that handle CSV file operations. Among the listed functions, only writerow() is part of…
- A.
write() / write()
- B.
writerow() / writerow()
- C.
writeline() / writeline()
- D.
writelines() / writelines()
Attempted by 1801 students.
Show answer & explanation
Correct answer: B
The csv module must be imported in a Python program to use functions that handle CSV file operations. Among the listed functions, only writerow() is part of the csv module.
The writerow() function is used to write a single row to a CSV file. It is defined in the csv module and requires the module to be imported before use.
Other functions like write(), writeline(), and writelines() are not part of the csv module and are used for general file operations.