import csv def import_courses(file_path): with open(file_path, 'r') as file: reader = csv.reader(file) for row in reader: print(f"Importing course: {row[0]}") def export_courses(file_path): courses = ["Math", "Physics", "Chemistry"] with open(file_path, 'w', newline='') as file: writer = csv.writer(file) for course in courses: writer.writerow([course]) ]]>
这段代码可以帮助我们批量导入和导出课程信息。
本站部分内容及素材来源于互联网,由AI智能生成,如有侵权或言论不当,联系必删!