csv search and print

2007-06-18 Thread axjacob
I have a csv file containing lot of rows & columns. I wanted to search thru the 
heading for each column for a string and then print all the headings and the 
corresponding rows if a match is found.

Any advise?

Thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Htmllib help

2007-07-05 Thread axjacob

I am using html and formater as shown below. They are used as part of a larger 
program.

Even though I don't use any print statements, the htmllib seems to be throwing 
parts of the html page on to the standard out(my screen in this case). Is there 
a way to disable the output?

import htmllib
w = formatter.DumbWriter() 
format = formatter.AbstractFormatter(w)
p = htmllib.HTMLParser(format)
p.feed(inhtml)
p.close()
for x in p.anchorlist:
   "Use x in regex"


Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Htmllib help

2007-07-05 Thread axjacob
Thank you.

Thats right I don't need the output any where so I don't need to use the 
writer. I can remove it wowever will the formater work since it needs writer? 
Maybe I can use the Null writer?




 -- Original message --
From: "Gabriel Genellina" <[EMAIL PROTECTED]>
> En Thu, 05 Jul 2007 20:23:08 -0300, <[EMAIL PROTECTED]> escribió:
> 
> > I am using html and formater as shown below. They are used as part of a  
> > larger program.
> >
> > Even though I don't use any print statements, the htmllib seems to be  
> > throwing parts of the html page on to the standard out(my screen in this  
> > case). Is there a way to disable the output?
> >
> > import htmllib
> > w = formatter.DumbWriter()
> 
> Change the above line. From http://docs.python.org/lib/writer-impls.html:
> "class DumbWriter([file[, maxcol = 72]])
>   Simple writer class which writes output on the file object passed in as 
>  
> file or, if file is omitted, on standard output."
> 
> (From your code fragment it appears that you are not interested in any  
> output - in that case you don't need the writer at all. And maybe you can  
> use another parser, like HTMLParser.HTMLParser, so I'd ask why do you use  
> a writer in the first place?)
> 
> -- 
> Gabriel Genellina
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Class file location

2007-07-09 Thread axjacob

Is there a way to define a different directory for the generated 
.class(*$py.class) files than the current directory where the python scripts 
are located and executed from?

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Htmllib help

2007-07-09 Thread axjacob
Thank you.

The NullWriter worked perfectly. I will certainly look at HTMLParser. 

 -- Original message --
From: "Gabriel Genellina" <[EMAIL PROTECTED]>
> En Fri, 06 Jul 2007 03:44:20 -0300, <[EMAIL PROTECTED]> escribió:
> 
> > Thats right I don't need the output any where so I don't need to use the  
> > writer. I can remove it wowever will the formater work since it needs  
> > writer? Maybe I can use the Null writer?
> 
> Exactly. Look at the HTMLParser module too; depending on your needs, it  
> may be easier to use.
> 
> >  -- Original message --
> > From: "Gabriel Genellina" <[EMAIL PROTECTED]>
> >> En Thu, 05 Jul 2007 20:23:08 -0300, <[EMAIL PROTECTED]> escribió:
> >> >
> >> > Even though I don't use any print statements, the htmllib seems to be
> >> > throwing parts of the html page on to the standard out(my screen in  
> >> this
> >> > case). Is there a way to disable the output?
> >> >
> >> > import htmllib
> >> > w = formatter.DumbWriter()
> >>
> >> Change the above line. From  
> >> http://docs.python.org/lib/writer-impls.html:
> >> "class DumbWriter([file[, maxcol = 72]])
> >>Simple writer class which writes output on the file object passed in as
> >> file or, if file is omitted, on standard output."
> 
> -- 
> Gabriel Genellina
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Class file location

2007-07-09 Thread axjacob

My mistake. It is Jython.

 -- Original message --
From: Bjoern Schliessmann <[EMAIL PROTECTED]>
> [EMAIL PROTECTED] wrote:
> > Is there a way to define a different directory for the generated
> > .class(*$py.class) files than the current directory where the
> > python scripts are located and executed from?
> 
> Excuse me, since when does python generate .class files?
> 
> Regards,
> 
> 
> Björn
> 
> -- 
> BOFH excuse #439:
> 
> Hot Java has gone cold
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: FW: Re: e-mailing multiple values

2007-05-08 Thread axjacob
Thanks. 
That does help. When teh script sends a mail of the list item(all_data), the 
data shows up like this:

[('   Ham\n', '   eggs \n'), 
('   chicken  \n', '   thighs \n')]

So I have to figure out a way to cleanup the content

Thanks
Anil
 
> -- Forwarded Message: --
> From: "Ian Clark" <[EMAIL PROTECTED]>
> To: python-list@python.org
> Subject: Re: e-mailing multiple values
> Date: Tue, 8 May 2007 23:20:44 +
> > On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > >
> > > I have a script which has a method which returns multiple strings at once 
> > using the yield. I would like to send an e-mail of these values in a single 
> > e-mail instead of a mail for each string. How would I be able to do that?
> > >
> > > Thanks
> > > AJ
> > 
> > Are you looking for something like the following? If not, try posting
> > a small sampling of your code.
> > 
> > >>> def get_data():
> > ... data = ['ham', 'eggs', 'spam']
> > ... for item in data:
> > ... yield item
> > ...
> > >>> all_data = [item for item in get_data()]
> > >>> all_data
> > ['ham', 'eggs', 'spam']
> > 
> > Ian
> > -- 
> > http://mail.python.org/mailman/listinfo/python-list
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: e-mailing multiple values

2007-05-09 Thread axjacob

Since e-mail requires a string. Here is what I could do.

list.append(item1)
list.append(item2)

finalstr = ''.join(list)
return finalstr
 -- Original message --
From: "Gabriel Genellina" <[EMAIL PROTECTED]>
> En Tue, 08 May 2007 20:19:22 -0300, Ian Clark <[EMAIL PROTECTED]> escribió:
> 
> > On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >>
> >> I have a script which has a method which returns multiple strings at  
> >> once using the yield. I would like to send an e-mail of these values in  
> >> a single e-mail instead of a mail for each string. How would I be able  
> >> to do that?
> >
> > Are you looking for something like the following? If not, try posting
> > a small sampling of your code.
> >
>  def get_data():
> > ... data = ['ham', 'eggs', 'spam']
> > ... for item in data:
> > ... yield item
> > ...
>  all_data = [item for item in get_data()]
>  all_data
> > ['ham', 'eggs', 'spam']
> 
> Or simply: all_data = list(get_data())
> 
> -- 
> Gabriel Genellina
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list