473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to read a tab delimited file

how would i read a tab delimited file? at the same time put what i
read in an array, say for example that i know that the file is an
array with column= 5 and row=unknown.
Jul 18 '05 #1
3 4699
jrlen balane wrote:
how would i read a tab delimited file? at the same time put what i
read in an array, say for example that i know that the file is an
array with column= 5 and row=unknown.


Use the "csv" module. Although that stands for "comma
separated values", it readily supports alternative
delimiters such as TAB.

-Peter
Jul 18 '05 #2
if i am going to do this, how should i continue:
how would i know the end of file?
table_data = open(filename, 'r')
table_data.readlines()
On Tue, 15 Mar 2005 23:37:50 -0500, Peter Hansen <pe***@engcorp.com> wrote:
jrlen balane wrote:
how would i read a tab delimited file? at the same time put what i
read in an array, say for example that i know that the file is an
array with column= 5 and row=unknown.


Use the "csv" module. Although that stands for "comma
separated values", it readily supports alternative
delimiters such as TAB.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #3
> Peter Hansen wrote:
jrlen balane wrote:
how would i read a tab delimited file? at the same time put what i
read in an array, say for example that i know that the file is an
array with column= 5 and row=unknown.
Use the "csv" module. Although that stands for "comma
separated values", it readily supports alternative
delimiters such as TAB.


jrlen balane top-posted: if i am going to do this, how should i continue:
how would i know the end of file?


Look at the examples in the docs:

http://docs.python.org/lib/node617.html

STeVe
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ron | last post by:
I have a text file with the following format (pipe delimited) |column1=value|column2=value|column3=value|column4=value|... |column1=value|column2=value|column3=value|column4=value|... I have...
3
by: Ben | last post by:
Hi all - I am having a bit of trouble and thought maybe someone in this group could shed some light. Here's the skinny... I am creating an automated process to import a bunch of text files...
3
by: Brian Kitt | last post by:
I have a .CSV file that I need to read, reformat, and write back out as a TAB delimited file. I can't use a slick utility such as DTS, because I have a lot of tweaking I need to do on the data...
2
by: Darin | last post by:
I have the following code that opens a comma-delimited text file: connS = "Provider=Microsoft.Jet.OLEDB.4.0;" connS &= "Data Source=\tmp;" connS &= "Extended...
5
by: Denis Petronenko | last post by:
Hello, how can i read into strings from ifstream? file contains values in following format: value11; val ue12; value 13; valu e21;value22; value23; etc. i need to read like file >string,...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
4
by: Karl | last post by:
How do you read a tab delimited text file? The file has 3 colums of data. I can read fixed width text files using the left and mid functions. I had rather not use transfer text and import specs.
3
by: Ray | last post by:
Hello World, I made a Windowsform that reads data from a CSV file. It works fine, but when I have read the data of a record I have to re-Debug the form to read another record. So when I put a...
4
by: =?Utf-8?B?Ym9iYnk=?= | last post by:
Hi, I have a excel file, also saved as tab delimited file. Now this tab delimited file has text(as table) for eg date empid empsal 10/01/2007 1 20000 now i want...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.