say, if I have a list l = [1,2,3,5]
and another tuple t = ('r', 'g', 'b')
Suppose I iterate over list l, and t at the same time, if I use the zip
function as in zip(l,t) , I will not be able to cover elements 3 and 5 in list l
>>> l = [1,2,3,5]
>>> t = ('r', 'g', 'b')
>>> for i in zip(l,t):
..
On 17/06/07, Iyer <[EMAIL PROTECTED]> wrote:
>
> say, if I have a list l = [1,2,3,5]
>
> and another tuple t = ('r', 'g', 'b')
>
> Suppose I iterate over list l, and t at the same time, if I use the zip
> function as in zip(l,t) , I will not be able to cover elements 3 and 5 in
> list l
>
> >>> l =
"Iyer" <[EMAIL PROTECTED]> wrote
> Any pythonic way to iterate over a sequence, while iterating
> over another shorter sequence continously
I don;t know how pythonic it is, but I'd do it thus:
>>> a = (1, 2, 3, 4)
>>> b = ('a', 'b', 'c')
>>> n = len(a)/len(b) + 1
>>> t = map(None,a,b*n)[:len(
Alan Gauld wrote:
> "Iyer" <[EMAIL PROTECTED]> wrote
>
>
>> Any pythonic way to iterate over a sequence, while iterating
>> over another shorter sequence continously
>>
The first thing that occurred to me was just to use a modulus to index
into the second, shorter list.
>>> l = [1,2,3,4
"Luke Paireepinart" <[EMAIL PROTECTED]> wrote
> The first thing that occurred to me was just to use a modulus to
> index
> into the second, shorter list.
That was the first thing that occured to me too but when
I tried it I couldn't get it to work...
> >>> l = [1,2,3,4,5]
> >>> t = ('r','g','b
On Jun 17, 2007, at 3:44 AM, John Fouhy wrote:
> On 17/06/07, Iyer <[EMAIL PROTECTED]> wrote:
>>
>> say, if I have a list l = [1,2,3,5]
>>
>> and another tuple t = ('r', 'g', 'b')
>>
>> Suppose I iterate over list l, and t at the same time, if I use
>> the zip
>> function as in zip(l,t) , I wil
Hello people,
I was trying my hands on Python's Classes and have a first hurdle and can't
seem to get past it.
-Below is the error message --
Traceback (most recent call last):
File "C:/Development/python/EmplAddrBookEntry.py", line 3, in -toplevel-
class EmplAddrBookEntry(AddrBoo
Henry Dominik wrote:
> Hello people,
>
> I was trying my hands on Python's Classes and have a first hurdle and can't
> seem to get past it.
>
> -Below is the error message --
>
> Traceback (most recent call last):
> File "C:/Development/python/EmplAddrBookEntry.py", line 3, in -toplevel-
I am new to Python and trying to get my head around catia V5
I would like to start to write some automated process in python for catia,
does anybody know the way to or some docs maybe?
cheers
Pierre
___
Tutor maillist - Tutor@python.org
http://mail.py
I love this [Tutor] list. There are always new tricks that change the
way I write code. And it makes me like Python more every day.
I keep a script file with "notes" on the things I learn here and I refer
to these notes frequently. Here are the notes I made for this thread:
""" iterate/map/modu
"Henry Dominik" <[EMAIL PROTECTED]> wrote
> import AddrBookEntry
>
> class EmplAddrBookEntry(AddrBookEntry):
This says you are creating a new class that inherits
from the *module* AddrBookEntry. Notice that the
error message referred to the module not the class...
You probably meant:
class
"pierre cutellic" <[EMAIL PROTECTED]> wrote
>I am new to Python and trying to get my head around catia V5
> I would like to start to write some automated process in python for
> catia,
> does anybody know the way to or some docs maybe?
Until your post I'd never even heard of Catia. Having looke
Thanks a million Alan,
Your suggestion helped solve the problem.
Besides, why did I have to do this: class
EmplAddrBookEntry(AddrBookEntry.AddrBookEntry):
The AddrBookEntry and EmplAddrBookEntry classes are in the same folder, I
didn't think I needed to call another module or something..
Well,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Well, Python is not Java :)
Unqualified names reference always only objects defined in the local
module by default.
If you want to use unqualified names, you could do something like that:
from AddrBookEntry import AddrBookEntry
or
import AddrBookE
bellzii wrote:
> hey everyone , can any1 tell me what does the module optparse do ?
It helps parse command line arguments. See the docs at
http://docs.python.org/lib/module-optparse.html
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.or
lucio arteaga wrote:
>
> - Original Message - From: "Kent Johnson" <[EMAIL PROTECTED]>
> To: "lucio arteaga" <[EMAIL PROTECTED]>
> Cc:
> Sent: Saturday, June 16, 2007 8:33 AM
> Subject: Re: [Tutor] using zip
>
>
>> lucio arteaga wrote:
>>> I am trying to learn using zip in combination o
Norman Khine wrote:
>
> Hi I have this class:
>
> def title_to_name(title):
> title = title.encode('ascii', 'replace')
> name = title.lower().replace('/', '_').replace('?',
> '_').replace('.', '')
> return '_'.join(name.split())
>
> Is there a way to have just one replace and so that
hey everyone , can any1 tell me what does the module optparse do ?
thanks 4 ur time
--
View this message in context:
http://www.nabble.com/newbie-question-tf3935888.html#a11162803
Sent from the Python - tutor mailing list archive at Nabble.com.
___
T
I have used a function to input the data and then a module Tproblem has
been solved .Thank you to all
From: "Kent Johnson" <[EMAIL PROTECTED]>
To: "lucio arteaga" <[EMAIL PROTECTED]>; "tutor-python"
Sent: Sunday, June 17, 2007 3:41 PM
Subject: Re: [Tutor] using zip
> lucio arteaga wrote:
>>
>
Hello
I'm trying to rewrite a chat-program i did in school this spring in
python, the school program was in java. All this to leran python.
Anyway. I m trying to send a message using udp to a server that
conntains the message 3 0 0 0, it has to be in network byte order and
unsigned. I have tried t
Tip: consult the documentation of the struct module.
Andreas
-- Ursprüngl. Mitteil. --
Betreff:[Tutor] sockets
Von:"Linus Nordström" <[EMAIL PROTECTED]>
Datum: 17.06.2007 22:47
Hello
I'm trying to rewrite a chat-program i did in school this spring in
python, the school progr
"Henry Dominik" <[EMAIL PROTECTED]> wrote
> Besides, why did I have to do this: class
> EmplAddrBookEntry(AddrBookEntry.AddrBookEntry):
>
> The AddrBookEntry and EmplAddrBookEntry classes
> are in the same folder,
Python doesn't care abpout the foldrs it only cares about
the modules. They ar
Oh, thank you, exactly what i was looking for :)
On 6/18/07, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:
> Tip: consult the documentation of the struct module.
>
> Andreas
>
> -- Ursprüngl. Mitteil. --
> Betreff:[Tutor] sockets
> Von:"Linus Nordström" <[EMAIL PROTECTED]>
> Datum:
"bellzii" <[EMAIL PROTECTED]> wrote
> hey everyone , can any1 tell me what does the module optparse do ?
It parses options.
That is it takes a command string and works out what
the various bits mean, in particular the command line
options or "switches".
For example you can call python like this
Alan Gauld wrote:
> What's available and in what state of readiness?
>
> I tried Boa Constructor but after half a dozen code tweaks
> I was still running into compatibility errors with the latest
> wxPython and gave up.
>
> I know that Glade is out there, but what state is it in?
> And PythonC
25 matches
Mail list logo