Re: [Tutor] How do I do cubic roots and cubic exponents (and higher roots and exponents) in Python?

2006-05-09 Thread Gregor Lingl
Danny Yoo schrieb: > > >>How do I do cubic (and higher) roots ... >> > >I think you're looking for the '**' operator. Like addition and >multiplication, it can take in two numbers. > >## > > 2 ** 2 >4 > > And they also can be floating point numbers >>> 2 **

Re: [Tutor] web intefaces?

2006-05-09 Thread Alfonso
Chad Crabtree wrote: > While everything that Alan Guald said is true, there are a couple of > options for you. Provided you know HTML (you must), you could > generate html pragmatically but, knowledge of html is still mandatory. > Your options are, basically > > http://www.cherrypy.org > Which is

[Tutor] 7bit - 8bit

2006-05-09 Thread János Juhász
Dear All, I have to convert a binary stream from a monitoring device to another format. The highets bit of data bytes is replaced by 0 and placed after every 7 bytes into a correction byte. I would like to decode it as simple as possible. May someone suggest an elegant solution for that ? Yo

Re: [Tutor] web intefaces?

2006-05-09 Thread Ron Phillips
I like Karrigell ...http://www.karrigell.com/ for being flexible, complete, lightweight, and easy to learn. I don't know how it scales, but that's not really a consideration for the applications you describe.   Ron>>> "Chad Crabtree" <[EMAIL PROTECTED]> 5/8/2006 6:29 PM >>>While everything that A

[Tutor] opening multiple connections to a port

2006-05-09 Thread Payal Rathod
Hi, I have to see how many open connection can a particular service handle. So, I want to similuate something like this but using Python. telnet I will be keeping these connections open for around 60 seconds. Can anyone tell me how do I start with this in Python? I read a bit about telnetlib,

Re: [Tutor] opening multiple connections to a port

2006-05-09 Thread Kent Johnson
Payal Rathod wrote: > Hi, > I have to see how many open connection can a particular service handle. > So, I want to similuate something like this but using Python. > telnet > > I will be keeping these connections open for around 60 seconds. Can > anyone tell me how do I start with this in Pytho

Re: [Tutor] 7bit - 8bit

2006-05-09 Thread Kent Johnson
János Juhász wrote: > Dear All, > > I have to convert a binary stream from a monitoring device to another > format. > The highets bit of data bytes is replaced by 0 and placed after every 7 > bytes into a correction byte. > I would like to decode it as simple as possible. > May someone suggest

Re: [Tutor] Should I use generators here?

2006-05-09 Thread Kent Johnson
Kent Johnson wrote: > Generators are not an optimization technique so much as a way to > structure code that includes iteration. This recipe is a good example of how using a simple generator can encapsulate a bit of processing that might be awkward to include in a larger processing loop. Genera

Re: [Tutor] web intefaces?

2006-05-09 Thread Alfonso
Ron Phillips wrote: > I like Karrigell ...http://www.karrigell.com/ for being flexible, > complete, lightweight, and easy to learn. I don't know how it scales, > but that's not really a consideration for the applications you describe. > > Ron > > >>> "Chad Crabtree" <[EMAIL PROTECTED]> 5/8/2006 6

[Tutor] Summing part of a list

2006-05-09 Thread Matthew Webber
I have a list that looks a bit like this - [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299), (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3), (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)] The list items are tuples, the first item of which is a coun

Re: [Tutor] Summing part of a list

2006-05-09 Thread Kent Johnson
Matthew Webber wrote: > I have a list that looks a bit like this - > > [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299), > (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3), > (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)] > > The list items are tuple

Re: [Tutor] Summing part of a list

2006-05-09 Thread Bob Gailer
Matthew Webber wrote: > I have a list that looks a bit like this - > > [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299), > (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3), > (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)] > > The list items are tuples

Re: [Tutor] Summing part of a list

2006-05-09 Thread Matthew Webber
To expand on my original posting, I came up with this code which works ok : count_country_aggregated = [cc for cc in count_country if cc[1]>3] count_country_aggregated.append(('OTHER',sum([cc[1] for cc in count_country if cc[1]<=3]))) But it uses 2 list comprehensions (therefore 2 passes of the o

Re: [Tutor] Call for volunteer to help revise images for One Day of IDLE Toying

2006-05-09 Thread Danny Yoo
> One of the major complaints that people have made about the "One Day of IDLE > Toying" tutorial I've written is that the screenshots are badly outdated. > >http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/ > > I was curious if anyone wanted to volunteer to provide fresh, updated > Windo

Re: [Tutor] web intefaces?

2006-05-09 Thread Christian Wyglendowski
> > >>> "Chad Crabtree" <[EMAIL PROTECTED]> 5/8/2006 6:29 PM >>> > > While everything that Alan Guald said is true, there are a > couple of > > options for you. Provided you know HTML (you must), you > could generate > > html pragmatically but, knowledge of html is still mandatory. > > Your op

Re: [Tutor] Summing part of a list

2006-05-09 Thread Matthew Webber
Thanks Kent, I liked the generator solution (I knew there had to be something like that). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: 09 May 2006 17:54 Cc: tutor@python.org Subject: Re: [Tutor] Summing part of a list << snip >> Hm

Re: [Tutor] web intefaces?

2006-05-09 Thread Andre Roberge
On 5/9/06, Christian Wyglendowski <[EMAIL PROTECTED]> wrote: [on creating a web app...] > > If you do go with CherryPy, check out this recipe I submitted to the > online Python Cookbook: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442481 > > It was written for CherryPy 2.1 but should

Re: [Tutor] web intefaces?

2006-05-09 Thread Python
On Mon, 2006-05-08 at 18:29 -0400, Chad Crabtree wrote: > While everything that Alan Guald said is true, there are a couple of > options for you. Provided you know HTML (you must), you could > generate html pragmatically but, knowledge of html is still mandatory. > Your options are, basically >

[Tutor] help with erros using subprocess module

2006-05-09 Thread Jerome Jabson
Hi, I've been trying to write a wrapper around some shells scripts using the subprocess module. But I'm getting errors I quite don't know how to debug. I've only been writing Python for a few months and starting processes are new to me. Here's my code: import os import re import subprocess #

[Tutor] question regarding subprocess.Popen

2006-05-09 Thread Yi Qiang
Hi list, I am launching another python program in my python daemon like this: pobj = subprocess.Popen(tlsmd, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT,