无法在python中读取CSV.file

我使用DictReader()读取了CSV文件并制作了一个副本,而对该副本进行更改却影响了原始文件,为什么?

这是代码:

str_group = {}

with open(sys.argv[1],"r") as csv_file: # reading the csv file into memoery
    csv_reader = csv.DictReader(csv_file)

    for line in csv_reader:
        str_group = line.copy()
        break
    for line in csv_reader:
        print(line)

del str_group['name']
print(str_group)

and here is a pic of the CSV file: n

and here is the output: enter image description here

评论