当我在Python中练习CSV文件的知识时遇到了问题。我写了一些函数,比如从CSV文件读取,在现有的CSV文件中添加新数据,现在我想添加一个允许用户从CSV文件中删除一些数据的函数。我的添加新数据的功能如下:def writein():
with open('employee data.csv', 'a') as employeeData:
writeby = csv.writer(employeeData, delimiter = ',')
writeNEN = input('Enter the name of the new employee: \n')
writeNESN = input('Enter the surname of the new employee: \n')
writeNEP = input('Enter the position of the new employee: \n')
writeNEBD = input('Enter the date of birth of the new employee: \n')
writeby.writerow([writeNEN, writeNESN, writeNEP, writeNEBD])
现在,我想创建相同的函数,但不是添加,而是删除现有数据。我试过这样:
^{pr2}$
但csv模块中没有类似“remove”或“delete”的属性。在
如何编写允许删除少量数据的函数?在