from urllib.request import urlopen
    from io import StringIO
    import csv
    
    data = urlopen("http://pythonscraping.com/files/MontyPythonAlbums.csv").read().decode('ascii', 'ignore')
    dataFile = StringIO(data)
    
    # csvReader = csv.reader(dataFile)
    # for row in csvReader:
    #     print(row)
    
    dictReader = csv.DictReader(dataFile)
    print(dictReader.fieldnames)
    for row in dictReader:
        print(row)
    
    import csv
    
    # 读取 CSV 文件
    file = open('test.csv')
    reader = csv.reader(file)
    data = list(reader)
    print(data)
    print(data[0][0])
    
    # 写入 CSV 文件
    file = open('test.csv', 'w', newline='')
    writer = csv.writer(file)
    writer.writerow(['spam', 'eggs'])
    writer.writerow(['spam', 'eggs'])
    
    writer = csv.writer(file, delimiter='\t', lineterminator='\n\n')
    writer.writerow(['apple', 'banana'])
    writer.writerow(['apple', 'banana'])
    
    file.close()