我正在尝试做一个库存跟踪或项目跟踪程序。在下面的set_header_row()方法中,我希望用户能够根据需要替换头。但我不知道如何删除标题。我一直在寻找一个解决办法来做类似的事情,但我找不到。如果需要进一步澄清,请告诉我。在import csv
class Product:
def __init__(self, file, mode):
self.f = file
self.m = mode
self.product_list = None
self.l = None
def open_file(self):
"""This class was made to be used within the class itself
This method is used to open a file specified and mode
It stores it in a variable and returns it to be used"""
try:
self.product_list = open(self.f, self.m)
print("File open successfully!")
print("File opened: " + str(self.f) + "\nMode: " + str(self.m))
return self.product_list
except FileNotFoundError:
print("The file you have specified does not exist.")
except PermissionErr