hey Xavier thnx a lot :) its working and ya.. i got your pont regarding typecasting .
jhinak On Fri, Jul 10, 2009 at 3:30 PM, <python-list-requ...@python.org> wrote: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body 'help' to > python-list-requ...@python.org > > You can reach the person managing the list at > python-list-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > > Today's Topics: > > 1. A zlib question (Roland Hedberg) > 2. Re: help me to find the error (Xavier Ho) > 3. Re: Concatenating images (numpy arrays), but they look like > HSV images (Sebastian Schabe) > > > ---------- Forwarded message ---------- > From: Roland Hedberg <rol...@catalogix.se> > To: python-list@python.org > Date: Fri, 10 Jul 2009 11:33:25 +0200 > Subject: A zlib question > Hi! > > I have a problem with zlib and compressing/decompressing according to RFC > 1951. > > It seems like I can decompress, something compressed according to RFC 1951 > by someone else, provided I set wbits to something negative (used -8 but I > guess any negative number would work?). > > But how can I compress using zlib so it doesn't add a gzip header ? > > -- Roland > > > ---------- Forwarded message ---------- > From: Xavier Ho <cont...@xavierho.com> > To: python-list@python.org > Date: Fri, 10 Jul 2009 17:53:15 +0800 > Subject: Re: help me to find the error > I'm new to Python myself, but I think it's because the method readlist() > returns a list. Hence, f0 is typed 'list'. And lists can't be closed. > > If you leave it to: > > *f0= open("temp9","r+") > > *and then assign another variable to the readlist, such as: > > *lines = f0.readlines()* > > Then in the for loop, change f1 to > > *f1=lines[i].split()* > > That may just stop it from complaining. > > Untested, but logically it's sound. > > Hope that works, > > Ching-Yun "Xavier" Ho, Technical Artist > > Contact Information > Mobile: (+61) 04 3335 4748 > Skype ID: SpaXe85 > Email: cont...@xavierho.com > Website: http://xavierho.com/ > > > On Fri, Jul 10, 2009 at 5:41 PM, jhinak sen <jhinak....@gmail.com> wrote: > >> hi, >> i am a beginner in python language, >> >> i am trying with this programme : >> to find the addition and mean from a data set in a file and writing the >> mean and sum in some other file : >> "" >> *#! /usr/bin/env python >> >> import re >> import cPickle as p >> import math >> from numpy import * >> >> f0= open("temp9","r+").readlines() >> f2= open("out1","r+") >> add_1=[ ]; >> for i in range(0, len(f0)): >> f1=f0[i].split() >> add= float(f1[1])+float(f1[2]) >> mean= float(add)/2 >> print (f1[1]).ljust(6) ,(f1[2]).ljust(6),repr(add).ljust(7), >> repr(mean).ljust(7) >> add_1.append(add) >> add_1.append(mean) >> f2.write("%s" % repr(add).ljust(7)),f2.write("%s" % >> repr(mean).ljust(7)) >> print "printing from file" >> for i in range(0, len(add_1),2): >> print add_1[i]," ", add_1[i+1] >> >> f0.close() >> f2.close()* >> >> >> "" >> >> and this programme is givving me this error : >> >> "" *Traceback (most recent call last): >> File "./temporary1.py", line 24, in <module> >> f0.close() >> AttributeError: 'list' object has no attribute 'close'* >> "" >> >> please help to to find the error. >> or suggest some simpler or better way >> >> note: >> 1)file "temp9" is already exist >> 2)this programme is giving me all my outputs, but at the end of the out >> ..its giving me that error. >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> >> > > > ---------- Forwarded message ---------- > From: Sebastian Schabe <sebastian.sch...@gmx.de> > To: python-list@python.org > Date: Fri, 10 Jul 2009 12:01:51 +0200 > Subject: Re: Concatenating images (numpy arrays), but they look like HSV > images > Robert Kern schrieb: > >> Probably, you need to use zeros(..., dtype=uint8). When you use dtype=int, >> that will result in dtype=int arrays. I suspect that matplotlib is then >> interpreting that to mean that you want it to treat the input as scalar data >> (which it will pass through a colormap) rather than an RGB image. >> >> > Thanks Robert, that was exactly the problem. Now I'am really wondering how > one can know such details. Well, with your answer I searched again in the > mathplotlib documentation and under the function imshow(X, ...) I indeed > found the hint, that X has to be an uint8 or float array or PIL image, but > before I hadn't known where to search. > > So again, thank you > > Sebastian > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list