A CsvReader represents a reader that provides forward-only access to a CSV text data source. A CsvReader may also support other delimited-separator formats.
Questions tagged [csvreader]
172 questions
-1
votes
2 answers
I'm trying to read a CSV file only if it i has between 200 and 400 records
I'm trying to read the CSV file only if has between 200 and 400 records. I want it to ignore otherwise. For some weird reason my code never reaches the print(row) line
with open(file) as csv_file:
row_count = sum(1 for line in csv_file)
if…

Ishira Liyanage
- 3
- 5
-1
votes
2 answers
Writing/appending data to a CSV file, column wise, in JAVA
I want to write/append data to a CSV file, column-by-column, in below fashion:
query1 query2 query3
data_item1 data_item7 data_item12
data_item2 data_item8 data_item13
data_item3 data_item9 data_item14
…

Anant Vikram Singh
- 109
- 1
- 3
- 14
-1
votes
2 answers
Remove Brackets and Single quotes from list loaded from CSV file
I am opening a .csv file that contains links and I want to navigate to each one. But when i print the list of links, it has brackets and single quotes around them. How do I print the links without the brackets and single quotes?
import csv
import…

BigEfromDaBX
- 157
- 1
- 2
- 10
-2
votes
1 answer
Why does it not print line even though my csv file contains data in vscode but it works in pycharm?
After running the code in the terminal I only get a message
PS C:\Users\xxxx\OneDrive\Desktop\Python> & C:/Users/xxxx/AppData/Local/Programs/Python/Python311/python.exe
c:/Users/xxxx/OneDrive/Desktop/Python/test.py
I also added a print "hello"…
-2
votes
1 answer
How to read a CSV file, remove a column, and replace the file
I have a CSV file in my local folder. I would like to read it, remove a column, and replace the file in the same folder.
Actual sample data:
ID,EMAIL,FIRSTNAME,LASTNAME …

ychaulagain
- 73
- 1
- 8
-3
votes
1 answer
How to break csv reader loop after the first condition is met?
with open("ten.csv", 'rb') as f:
reader = cs.DictReader(f)
for row in reader:
for i in range(len(list_of_column_names[0])):
if isPhoneNumber(str(row[list_of_column_names[0][i]])) == True:
…

tlowa
- 3
- 2
-3
votes
1 answer
so when I enter something thats not in the csvfile, it will just stop running
I'm print what's on a CSV file by searching it up but if I enter a different name that's not on the CSV file it will just stop running for some reason. For example in the input when I enter (hello) which is not in the CSV file, it will just stop…

Olivia Smith
- 1
- 2