Re: [Tutor] Files Merging

2012-10-11 Thread Sunil Tech
Thanks all for your immediate responses :) On Thu, Oct 11, 2012 at 6:20 PM, Joel Goldstick wrote: > On Thu, Oct 11, 2012 at 8:30 AM, eryksun wrote: > > On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech > wrote: > >> > >> text1 contains > >> This is from Text1 --- 1st line > >> > >> > >> text2 co

Re: [Tutor] Files Merging

2012-10-11 Thread Joel Goldstick
On Thu, Oct 11, 2012 at 8:30 AM, eryksun wrote: > On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech wrote: >> >> text1 contains >> This is from Text1 --- 1st line >> >> >> text2 contains >> This is from Text2 --- 1st line >> >> >> i want result in text3 like >> This is from Text1 --- 1st line

Re: [Tutor] Files Merging

2012-10-11 Thread eryksun
On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech wrote: > > text1 contains > This is from Text1 --- 1st line > > > text2 contains > This is from Text2 --- 1st line > > > i want result in text3 like > This is from Text1 --- 1st line > This is from Text2 --- 1st line > > but condition is "

Re: [Tutor] Files Merging

2012-10-11 Thread Sunil Tech
i used zip(), but it gives me result in list of tuples format. But i don't get in a exact expect format (as mentioned) no loopings are allowed. On Thu, Oct 11, 2012 at 5:30 PM, Dave Angel wrote: > On 10/11/2012 07:13 AM, Sunil Tech wrote: > > Hi all, > > > > Greetings to you... > > it been so he

Re: [Tutor] Files Merging

2012-10-11 Thread Dave Angel
On 10/11/2012 07:13 AM, Sunil Tech wrote: > Hi all, > > Greetings to you... > it been so helpful for me to go through your all mails & support & i wish > it still continues. > > I have two text files. > > text1 contains > > This is from Text1 --- 1st line > This is from Text1 --- 2nd line > This is

[Tutor] Files Merging

2012-10-11 Thread Sunil Tech
Hi all, Greetings to you... it been so helpful for me to go through your all mails & support & i wish it still continues. I have two text files. text1 contains This is from Text1 --- 1st line This is from Text1 --- 2nd line This is from Text1 --- 3rd line This is from Text1 --- 4th line This is

Re: [Tutor] files

2007-09-01 Thread Ricardo Aráoz
Alan Gauld wrote: > "Ricardo Aráoz" <[EMAIL PROTECTED]> wrote > > In = open(r'E:\MyDir\MyDoc.txt', 'rb') > Out = open(r'E:\MyDir\MyUpperDoc.txt', 'wb') > Out.write(In.read().upper()) > In.close() > Out.close() >> Pretty simple program. The question is : If 'In' is a HUGE file,

Re: [Tutor] files

2007-09-01 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote In = open(r'E:\MyDir\MyDoc.txt', 'rb') Out = open(r'E:\MyDir\MyUpperDoc.txt', 'wb') Out.write(In.read().upper()) In.close() Out.close() > > Pretty simple program. The question is : If 'In' is a HUGE file, how > does Python process

[Tutor] files

2007-09-01 Thread Ricardo Aráoz
Hi, I am in doubt : >>> In = open(r'E:\MyDir\MyDoc.txt', 'rb') >>> Out = open(r'E:\MyDir\MyUpperDoc.txt', 'wb') >>> Out.write(In.read().upper()) >>> In.close() >>> Out.close() Pretty simple program. The question is : If 'In' is a HUGE file, how does Python process it? Does it treat it as a stream

[Tutor] Files and Modules

2006-06-09 Thread Carroll, Barry
Kermit: > -- > > Message: 7 > Date: Fri, 09 Jun 2006 11:02:44 -0400 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] file attribute of module > Cc: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1; format=

Re: [Tutor] files - strings - lists (continued)

2005-12-05 Thread Andrzej Kolinski
the way. Is the individual db appropriate for this or I should be looking for a dictionary type format. I am lost.        _/_/      _/     _/   _/       _/  _/   _/  _/_/_/_/  _/ _/ _/      _/  _/   _/ _/     _/  _/      _/ Andrzej Kolinski Kent Johnson <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 24/11/2005 08:40 PM To

Re: [Tutor] files - strings - lists

2005-11-26 Thread Kent Johnson
Andrzej Kolinski wrote: > > OK, I made some progress I think. I added a few lines to Kent's script > to get closer what I really am after: Congratulations! See some notes below. > > == > lines = open('liga050926.sbk') # to get the data from a real fi

Re: [Tutor] files - strings - lists

2005-11-26 Thread Kent Johnson
Andrzej Kolinski wrote: > > OK, I made some progress I think. I added a few lines to Kent's script > to get closer what I really am after: Congratulations! See some notes below. > > == > lines = open('liga050926.sbk') # to get the data from a real

Re: [Tutor] files - strings - lists

2005-11-24 Thread Andrzej Kolinski
ohnson <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 23/11/2005 11:03 AM To cc tutor@python.org Subject Re: [Tutor] files - strings - lists Andrzej Kolinski wrote: > > I want to create a program that uses data from text files, makes > appropriate calculations and pr

Re: [Tutor] files - strings - lists

2005-11-23 Thread Chris or Leslie Smith
Danny wrote: | Hi Chris, | | Yes, I suspect that this happens a lot. I have my own little formatting | reader that simulates some of the features of C's scanf, for example: | |http://hkn.eecs.berkeley.edu/~dyoo/python/scanf/ | | so I think it's one of those little exercises that everyone e

Re: [Tutor] files - strings - lists

2005-11-23 Thread Andrzej Kolinski
Thank you Kent, Chris, Danny, This is superb, let me work on my part for now and I promise get back to the group with more ...          _/_/      _/     _/   _/       _/  _/   _/  _/_/_/_/  _/ _/ _/      _/  _/   _/ _/     _/  _/      _/ Andrzej Kolinski wrote: > > I want to create a

Re: [Tutor] files - strings - lists

2005-11-23 Thread Danny Yoo
> Great links, Danny. Thanks. I had seen mxTextTools before but didn't > search for the right thing before raising the question. The pyparsing > seems very interesting. The code that I attach below is a very > light-weight version of a formatted reader. It assumes that you just > want to pluck

Re: [Tutor] files - strings - lists

2005-11-23 Thread Chris or Leslie Smith
Danny Yoo wrote: | On Wed, 23 Nov 2005, Chris or Leslie Smith wrote: | || I agree that handling this with Python is pretty straightforward, but || I'm wondering if there exists some sort of mechanism for reading || these types of well structured (though not XML format, etc...) files. | | Hi Chris

Re: [Tutor] files - strings - lists

2005-11-23 Thread Danny Yoo
On Wed, 23 Nov 2005, Chris or Leslie Smith wrote: > I agree that handling this with Python is pretty straightforward, but > I'm wondering if there exists some sort of mechanism for reading these > types of well structured (though not XML format, etc...) files. Hi Chris, Yes, take a look at "pa

Re: [Tutor] files - strings - lists

2005-11-23 Thread Chris or Leslie Smith
| | With these tools the solution is pretty simple. I agree that handling this with Python is pretty straightforward, but I'm wondering if there exists some sort of mechanism for reading these types of well structured (though not XML format, etc...) files. Something like a reverse template, s

Re: [Tutor] files - strings - lists

2005-11-23 Thread Kent Johnson
Andrzej Kolinski wrote: > > I want to create a program that uses data from text files, makes > appropriate calculations and produces report. First I need to find out > what is the right way to retrieve appropriate information from an input > file. This is a typical format of the input file: >

[Tutor] files - strings - lists

2005-11-23 Thread Andrzej Kolinski
I want to create a program that uses data from text files, makes appropriate calculations and produces report. First I need to find out what is the right way to retrieve appropriate information from an input file. This is a typical format of the input file: 1 Polonijna Liga Mistrzow        |from

Re: [Tutor] files in a directory

2005-01-31 Thread Danny Yoo
> Now that I am reading many files at once, I wanted, to > have a tab delim file op that looks like this: > > My_coors Int_file 1 Int_file2 > IntFile3 > 01:26 34 235 > 245.45 > 04:42 342.4452.445.5 > 02:56 45.4

Re: [Tutor] files in a directory

2005-01-30 Thread kumar s
Thank you Jay. It worked, I am V.V.happy. I tried Liam's suggestion also, but some weird things are going and I am not only getting results but also any error. I am working on that. Other thing. I a feeding my parser some coordinates specified by me, where I am asking the parser to extract the

Re: [Tutor] files in a directory

2005-01-30 Thread Chad Crabtree
Well in the same vein as what the others put out there I made a verbose 'ls *.ext' so that you can see how to do it in one go. I figured this would give you enough of an example. You can hard code these things into your program. I used a construct similar to this to create an instant html ph

Re: [Tutor] files in a directory

2005-01-30 Thread Liam Clarke
Hey Kumar, You redirect stdin a lot. try this. import os def parse(filename): try: f1 = open(filename,'r') except IOError: return #Listdir returns a list of files and sub-dirs, and an attempt #to open a sub-dir raises an IOError. int = f1.read().split('\n') my

Re: [Tutor] files in a directory

2005-01-30 Thread Jay Loden
There's a few ways to accomplish this...the way that comes to mind is: ## import glob files = glob.glob("/path/to/director/*.dml") # assuming you want only .dml def spot(file): '''search for intensity spots and report them to an output

[Tutor] files in a directory

2005-01-30 Thread kumar s
Hello. I wrote a parser to parse spot intensities. The input to this parser i am giving one single file f1 = open('my_intensity_file.dml','r') int = f1.read().split('\n') my_vals = intParser(int) intParser return a list f2 = open('myvalues.txt','w') for line in my_vals: f2.write(line)