Re: [Tutor] aBSOLUTE BEGINNER

2007-10-18 Thread Abhishek Negi
Hi all thanks for your help guys...I ll explain my condition, I am an application programmer doing maintenance and enhancement work basically on CICS and a little bit in DB2i had been working patiently on JCL and learn COBOL but haven't learn REXX.but the problem is that whenever i want to

Re: [Tutor] accessing data in a usable format

2007-10-18 Thread Bryan Fodness
> > Thank you both options work easily with my problem. Bryan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] accessing data in a usable format

2007-10-18 Thread jon vspython
What about this? dic = {} for line in file("findvalue.dat"): a,b,c,d = line.split() dic [a] = (float(b), float(c), float(d)) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Mainframe Technology (was: aBSOLUTE BEGINNER) (OT)

2007-10-18 Thread Alan Gauld
"Carroll, Barry" <[EMAIL PROTECTED]> wrote > IBM's mainframes are now constructed out of massively pararallel > arrays > of MPUs. In other words, all that number crunching is done by > hundreds > or thousands of souped up PCs, all connected together and stuffed > into a > single box. The pro

Re: [Tutor] accessing data in a usable format

2007-10-18 Thread John Fouhy
On 19/10/2007, Bryan Fodness <[EMAIL PROTECTED]> wrote: > for line in file('findvalue.dat'): > print[float(x) for x in line.split()] > > which returns: > > [1.0, 0.80004, 0.91003, 0.879] > [2.0, 0.86199, 0.93005, 0.92705] > [3.0, 0.901

Re: [Tutor] newbie question

2007-10-18 Thread jon vspython
>From http://diveintopython.org/getting_to_know_python/index.html, we can get this solution which works no matter the size of the dictionaries: print ' '.join(["%s" % (v,) for k,v in menu_specials.items()]) It generates a formatted string for value in the dictionary and then joins them using whit

Re: [Tutor] symbol encoding and processing problem

2007-10-18 Thread Kent Johnson
Timmie wrote: >> Was the problem with the print statements? Maybe changing the console >> encoding would help. I have some notes here: >> http://personalpages.tds.net/~kent37/stories/00018.html > Thanks, I read it yesterday evening. > > I still don't know why there is such a encoding mess on Pyth

Re: [Tutor] symbol encoding and processing problem

2007-10-18 Thread Timmie
> Was the problem with the print statements? Maybe changing the console > encoding would help. I have some notes here: > http://personalpages.tds.net/~kent37/stories/00018.html Thanks, I read it yesterday evening. I still don't know why there is such a encoding mess on Python. For me this totally

Re: [Tutor] Mainframe Technology (was: aBSOLUTE BEGINNER) (OT)

2007-10-18 Thread Carroll, Barry
> -Original Message- > Date: Thu, 18 Oct 2007 10:53:22 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] aBSOLUTE BEGINNER > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=origina

Re: [Tutor] symbol encoding and processing problem

2007-10-18 Thread Timmie
> Just be aware that this affects portability of your scripts; they will > require this same change to run on other systems. For this reason you > might want to change the code instead. > If you give a specific example of what is failing I will try to help. >From the previous posts I learned tha

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread jon vspython
Thanks Kent. I didn't see it. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread Kent Johnson
jon vspython wrote: > Cool! It works :-) > > But I don't get it. Where is the redirection? The fileinput module redirects stdout when you use inplace=1. See the section "Optional in-place filtering" here: http://docs.python.org/lib/module-fileinput.html You can read the source to fileinput (Lib

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread jon vspython
Cool! It works :-) But I don't get it. Where is the redirection? Thanks Ken. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread Kent Johnson
jon vspython wrote: > The file I got as a result won't work. I just wan't the pattern replaced. > Do you know how could I do it? Try my suggestion in previous email. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tu

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread jon vspython
I was not trying to get any output. I was trying to modify a source file in place, I just want to replace file content text automatically. So I tried first from python shell in linux. This is what I did: [EMAIL PROTECTED] aut]$ python Python 2.4.3 (#1, Oct 23 2006, 14:19:47) [GCC 4.1.1 20060525 (R

Re: [Tutor] open a webpage which may be unavailable

2007-10-18 Thread Alan Gauld
"pileux systeme" <[EMAIL PROTECTED]> wrote > I am trying to retrieve data from several webpages. > My problem is the following: after a random number of requests, > the page I'm trying to open is unavailable (and I get an IOError). > Note that the page may become available if I try again Thi

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread Kent Johnson
jon vspython wrote: > Hi, > I tried this on a file: > > for line in fileinput.input("myfile",inplace=1): > re.sub(r'LOOP',r'PRUEBALOOP',line) I'm not sure why you got any output at all. Were you running this in a shell that prints out loop values for you (e.g. IPython)? re.sub returns the m

Re: [Tutor] open a webpage which may be unavailable

2007-10-18 Thread Kent Johnson
pileux systeme wrote: > Hello, > > I am trying to retrieve data from several webpages. My problem is the > following: after a random number of requests, the page I'm trying to > open is unavailable (and I get an IOError). Note that the page may > become available if I try again after some time

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread jon vspython
Sorry, I think I should have explained what I was expecting to get. I wanted plain text back in my file. Real line feed and carrier returns instead of \r and \n, and so on. Thanks again, Jon. ___ Tutor maillist - Tutor@python.org http://mail.python.org/

Re: [Tutor] Regex parsing and writing to file

2007-10-18 Thread jon vspython
Hi, I tried this on a file: for line in fileinput.input("myfile",inplace=1): re.sub(r'LOOP',r'PRUEBALOOP',line) and for lines like this: PT_WT_INIT: LOOP I got this: 'PT_WT_INIT: PRUEBALOOP\r\n' I also tried without raw strings: re.sub('LOOP','PRUEBALO

[Tutor] open a webpage which may be unavailable

2007-10-18 Thread pileux systeme
Hello, I am trying to retrieve data from several webpages. My problem is the following: after a random number of requests, the page I'm trying to open is unavailable (and I get an IOError). Note that the page may become available if I try again after some time. Since I have thousands pages

Re: [Tutor] aBSOLUTE BEGINNER

2007-10-18 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > What does that mean... "mainframe technology"? I'll take a guess at what it means. A true mainframe is usually one of (or a clone of) IBM or ICLmainframe hardware running an OS like OS/390. It is primarily used for large volume data crunching and the appl