473,758 Members | 5,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4725
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.read lines()
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
496
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 two questions. 1. Is this some new type of text file format and if so, what is the name of it.
3
7033
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 into Access. I want to avoid creating a separate "Spec" for each file (there are over 180 files) and instead want to code my own dynamic importing rules. So far it's been going fine, except for one item...
3
54894
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 before it can be output. The data is true .CSV fasion, in other words, a record may look as follows: 1.23,"this is a ""special"" field",2,"brian's test","one,two,three",45.223344 There are embeded quotes, apostrophes, and commas in the data. This...
2
1959
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 Properties=""text;HDR=No;FMT=Delimited""" Dim tmpConnection As New System.Data.OleDb.OleDbConnection(connS) tmpConnection.Open() strsql = "SELECT * FROM PAYROLL.TXT" Dim da As New System.Data.OleDb.OleDbDataAdapter(strsql, tmpConnection)
5
3241
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, but strings must be divided by ";" separator.
9
5211
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 facing problems: Assume that FILE* filePointer; unsigned char lineBuffer;
4
8330
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
1818
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 new seek item in the textbox after I searched for an item and click the seek button.. it seems it is doing nothing. And also... what code can I use to genereate a messagebox message when a seek item is not at all in the CSV file?
4
4677
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 to read this table from txt file into a dataset. How can I do that.
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9906
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.