Your code is blanking out your file:

import csv
workingdir = "C:\Mer\Ven\sample"
csvfile = workingdir+"\test3.csv"
f=open(csvfile,'wb') # opens file for writing (erases contents)
csv.writer(f, delimiter =' ',quotechar =',',quoting=csv.QUOTE_MINIMAL)

if you want to read the file in, you will need to use csv.reader and open the file for reading.

import csv
workingdir = "C:\Mer\Ven\sample"
csvfile = workingdir+"\test3.csv"
f=open(csvfile,'rb') # opens file for reading
reader = csv.reader(f)
for line in reader:
    print line

If you want to write that back out to a new file with different delimiters, you can create a new file and specify those delimiters and write out each line (instead of printing the tuple).

Answer from underrun on Stack Overflow
🌐
Python
docs.python.org › 3 › library › csv.html
csv — CSV File Reading and Writing
Return a writer object responsible for converting the user’s data into delimited strings on the given file-like object. csvfile can be any object with a write() method. If csvfile is a file object, it should be opened with newline='' [1]. An optional dialect parameter can be given which is used to define a set of parameters specific to a particular CSV dialect.
Discussions

I need to find out what separator is used in a csv file

According to the documentation of read_csv, you can use the Python engine to auto-detect the separator. Something like this should do:

dataframe = pandas.read_csv("filename.csv", sep=None, engine="python")

This will make use of csv.Sniffer that can detect the separator and whether there's a header.

More on reddit.com
🌐 r/learnpython
22
19
August 31, 2020
Made a csv parser library which automatically detects delimiter and start and end of data
This post was mass deleted and anonymized with Redact divide wrench hungry support different longing juggle carpenter point engine More on reddit.com
🌐 r/Python
16
17
May 31, 2023
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.read_csv.html
pandas.read_csv — pandas 3.0.4 documentation
If you want to pass in a path object, pandas accepts any os.PathLike. By file-like object, we refer to objects with a read() method, such as a file handle (e.g. via builtin open function) or StringIO. ... Character or regex pattern to treat as the delimiter. If sep=None, the C engine cannot ...
🌐
Python Morsels
pythonmorsels.com › csv-reading
Reading a CSV file in Python - Python Morsels
January 23, 2023 - We can use csv.reader to read this file by specifying a delimiter of a tab character (\t):
🌐
Reddit
reddit.com › r/learnpython › i need to find out what separator is used in a csv file
r/learnpython on Reddit: I need to find out what separator is used in a csv file
August 31, 2020 -

Hey guys!

I have been using pandas to read csv files but there is a problem. The person that provides me the files does not use the comma separator. In order to automate the process, I would like to find out what separator is used in the file. This is essential because I am storing the values from the csv in a database with a psycopg2 function called copy_expert and if the number of columns in the file do not match the number of columns in the database table, an error occurs saying that it expected a different number of fields.

Anyway, does anyone know how to find which separator is used in a csv file?

🌐
Real Python
realpython.com › python-csv
Reading and Writing CSV Files in Python – Real Python
January 25, 2023 - In general, the separator character is called a delimiter, and the comma is not the only one used. Other popular delimiters include the tab (\t), colon (:) and semi-colon (;) characters. Properly parsing a CSV file requires us to know which ...
Find elsewhere
🌐
PDFTables
pdftables.com › blog › csv-change-delimiter-excel
How to change the delimiter in a CSV file — PDFTables
Replace freight_invoice.csv with name of your input file · Replace output.txt with name you'd like to give your output file · Replace the semicolon in delimiter=';' with a new delimiter of your choice · Open up an Anaconda Prompt instance. You can find this by searching in your computers search box. Press Enter to open an instance. Locate the folder in which the Python script is saved using cd ..
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-read-a-csv-file-to-a-dataframe-with-custom-delimiter-in-pandas
How to read a CSV file to a Dataframe with custom delimiter in Pandas? - GeeksforGeeks
July 15, 2025 - # Importing pandas library import pandas as pd # Load the data of example.csv # with '_' as custom delimiter # into a Dataframe df df = pd.read_csv('example2.csv', sep = '_', engine = 'python') # Print the Dataframe df
🌐
Esri Community
community.esri.com › t5 › python-questions › python-csv-writer-delimiter-with › td-p › 306625
Python csv.writer delimiter with \ ? - Esri Community
July 21, 2016 - How do I use a back slash as a delimiter, python wont recognize it. ofile = open('MapServicesInfo.csv', "w") writer = csv.writer(ofile, delimiter = '\', quotechar='"', quoting=csv.QUOTE_ALL)
🌐
Medium
medium.com › @AlexanderObregon › how-to-read-and-write-csv-files-in-python-b84fe274d51a
How to Read and Write CSV Files in Python | Medium
October 26, 2024 - Learn how to read and write CSV files in Python using the csv module, including handling delimiters, writing dictionaries, and parsing rows.
🌐
Vertabelo Academy
academy.vertabelo.com › course › python-csv › dialects › dialects › semicolon-as-delimiter
Read and Write CSV in Python | Learn Python | Vertabelo Academy
Create a new dialect that uses semicolons as field delimiters. Save the contents of the file to figures_semicolons.csv using the new dialect.
🌐
GeeksforGeeks
geeksforgeeks.org › python › writing-csv-files-in-python
Writing CSV files in Python - GeeksforGeeks
July 12, 2025 - The csv.writer class is used to write data directly to a CSV file. It handles the conversion of data to a delimited string format.
🌐
Reddit
reddit.com › r/python › made a csv parser library which automatically detects delimiter and start and end of data
r/Python on Reddit: Made a csv parser library which automatically detects delimiter and start and end of data
May 31, 2023 -

For most purposes, just passing the file path will be sufficient and you will have a pandas data frame of you data. Automatically neglects the random extra information at the top and bottom of a file. Also works with those annoying delimiter within quotes thingies (ex: you have a comma delimiter and one field is “John, Andrew and Steven”). It is on PyPI so you can download it with pip.

https://github.com/Oddball777/csv-scavenger

🌐
Python Forum
python-forum.io › thread-36975.html
Delimiter issue with a CSV file
April 19, 2022 - I'm trying to delete specific columns from a CSV file. The delete column works fine but the output of the columns remaining has changed. I need the column formats to be the same. Input csv data: 'Group','Title','URL','Notes' ouput csv data: Group,Ti...
🌐
Analytics Vidhya
analyticsvidhya.com › home › data analysis & processing using delimiters in pandas (updated 2026)
Pandas Read CSV Delimiter: A Comprehensive Guide (2026)
December 27, 2025 - As the name suggests, CSV (or Comma Separated Values) files have data items separated by commas. CSV files are plain text files that are lighter in file size. It uses comma (,) as the default delimiter or separator while parsing a file.
🌐
LearnLearn
learnlearn.uk › python unit home › python csv files tutorial
Python CSV Files Tutorial - Python
November 29, 2023 - CSV files usually use a comma as the delimiter between each data item, but sometimes might use a tab or other character instead.
🌐
Reddit
reddit.com › r/python › saving to csv with space after delimiter
r/Python on Reddit: Saving to CSV with space after delimiter
January 17, 2017 -

Teaching myself Python. Have hit a small roadblock. Below is my code.

import csv def save(): lst=[('a','b'),('c','d'),('e','f')] with open('something.csv','w', newline='') as csvfile: writer = csv.writer(csvfile, delimiter=',') for something in lst: writer.writerow(something) if name == 'main': save()

something.csv is: a,b c,d e,f

Is there a way to add a space between the comma and the next character. So that it looks something like this?:

a, b c, d e, f

Thank you for your help.

🌐
Alexwlchan
alexwlchan.net › 2018 › reading-a-utf8-encoded-csv
Notes on reading a UTF-8 encoded CSV in Python – alexwlchan
December 27, 2018 - But if you run that code in Python 3, you get the following error: Traceback (most recent call last): File "reader2.py", line 6, in <module> for row in csvreader: _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?) ... import csv with open("example.csv", encoding="utf8") as csvfile: csvreader = csv.reader(csvfile, delimiter=",") for row in csvreader: print(": ".join(row))
🌐
University Information Services
help.uis.cam.ac.uk › system › files › documents › csv.pdf pdf
Python 3: Structured text (CSV) files Bruce Beckles mbb10@cam.ac.uk Bob Dowling
There may be spaces after (or before) the delimiter to separate the fields, or the fields may be “padded out” · with spaces to make them all have the same number of characters. (The number of characters in a field is ... Obviously, we could write our own functions for making sense of (parsing) every arrangement of data we · come across, but there is an easier way for this large class of text files. We use one of the standard Python ... Compare data1.csv and data2.csv.
🌐
Packetswitch
packetswitch.co.uk › python-working-with-csv-files
Python - Read and Write CSV Files (with examples)
October 2, 2024 - The delimiter can be any single character, but , is predominantly used. Before we dive into working with CSV files, let's have a look at the fundamentals of working with files in Python.