Question: import os import csv # Create a file with data in it def create _ file ( filename ) : with open ( filename ,
import os
import csv
# Create a file with data in it
def createfilefilename:
with openfilenamew as file:
file.writenamecolor,type
file.writecarnationpink,annual
file.writedaffodilyellow,perennial
file.writeirisblue,perennial
file.writepoinsettiared,perennial
file.writesunfloweryellow,annual
# Read the file contents and format the information about each row
def contentsoffilefilename:
returnstring
# Call the function to create the file
createfilefilename
# Open the file
# Read the rows of the file
rows
# Process each row
for row in rows:
row
# Format the return string for data rows only
returnstring a is
format
return returnstring
#Call the function
printcontentsoffileflowerscsv
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
