Extract Text Table From File

Tim Chase python.list at tim.thechases.com
Wed Sep 5 12:25:02 EDT 2012


[trimming out a bunch of superfluous text so the thread is actually
readable]

On 09/05/12 08:08, Ramchandra Apte wrote:
> On Monday, 27 August 2012 15:42:14 UTC+5:30, Laszlo Nagy  wrote:
>> On 2012-08-27 11:53, Huso wrote:
>>> I am trying to extract some text table data from a log file
>>
>> fin = open("test.txt","r")
>>
>> for line in fin:
>>
>>      # This is one possible way to extract values.
>>
>>      values = line.strip().split()
>>
>>      print values
>
> the csv module should be used for this not regex

The problem is that the csv module expects a single delimiter
character, not columnar data.

-tkc





More information about the Python-list mailing list