You can seek the file directly. For example:
>>> f = open("csv.txt")
>>> c = csv.reader(f)
>>> for row in c: print row
['1', '2', '3']
['4', '5', '6']
>>> f.seek(0)
>>> for row in c: print row # again
['1', '2', '3']
['4', '5', '6']
More Related Contents:
- Update a CSV file?
- Writing a Python list of lists to a csv file
- How do I read and write CSV files with Python?
- How to get rid of “Unnamed: 0” column in a pandas DataFrame read in from CSV file?
- Python convert csv to xlsx
- Create and download a CSV file from a Flask view
- How to read file with space separated values in pandas
- Write dictionary of lists to a CSV file
- Pandas: ValueError: cannot convert float NaN to integer
- How to do row-to-column transposition of data in csv table?
- How to obtain the total numbers of rows from a CSV file in Python?
- Writing a csv file into SQL Server database using python
- What does ‘killed’ mean when processing a huge CSV with Python, which suddenly stops?
- pandas DataFrame output end of csv
- Use Multiple Character Delimiter in Python Pandas read_csv
- Get pandas.read_csv to read empty values as empty string instead of nan
- Deleting rows with Python in a CSV file
- Reading from CSVs in Python repeatedly?
- Loading multiple csv files of a folder into one dataframe
- Row count in a csv file
- Why can’t I repeat the ‘for’ loop for csv.Reader?
- IndexError: too many indices for array
- Proper way to reset csv.reader for multiple iterations?
- AttributeError: ‘module’ object has no attribute ‘reader’ [duplicate]
- Strip white spaces from CSV file
- Get data from Twitter using Tweepy and store in csv file
- How to add a new column to the beginning of the rows of a CSV file?
- Python Parse CSV Correctly
- start index at 1 for Pandas DataFrame
- pandas – convert string into list of strings [duplicate]