#!/usr/bin/python

# custom_dialect.py

import csv

csv.register_dialect("hashes", delimiter="#")

f = open('items3.csv', 'w')

with f:

    writer = csv.writer(f, dialect="hashes")
    writer.writerow(("pencils", 2)) 
    writer.writerow(("plates", 1))
    writer.writerow(("books", 4))

[((7, 0, 7, 45), 'csv.register_dialect', 'csv.register_dialect', (), '', False, 'import csv\n'), ((13, 13, 13, 44), 'csv.writer', 'csv.writer', (), '', False, 'import csv\n')]