John
In python, strings are immutable - you have to create a new string no
matter what you do.
Also, I suspect you meant to say:
>>> alphabet = string.ascii_lowercase
>>> code = alphabet[2:] + alphabet[:2]
I had a similar need recently for a guitar chord generator program I've
been working on.
Terry
That is very succint. Rewriting my shift function given earlier:
>>> import string
>>> alpha = string.ascii_lowercase
>>> print alpha
abcdefghijklmnopqrstuvwxyz
>>> def shift(lst, n):
return [lst[(i+len(lst)-n)%len(lst)] for i,item in enumerate(lst)]
>>> print shift(alpha,2)
['y',
Hi John
Your code works on some folders but not others. For example, it works
on my /usr/lib/python2.4 (the example you gave), but on other folders
it terminates early with StopIteration exception on the
os.walk().next() step.
I haven't really looked at this closely enough yet, but it looks as
Felipe
I get the same results as you. You make a good point about not
iterating when it's not needed. I played around with your test code
and found some interesting things:
1. enumerate vs. range(len()) has very little overhead (something I
have wondered about)
In my code, making the change c
Hi
I tried several Google searches to no avail. I read through pretty
much most of the online docs at the matplotlib sourceforge site, but
didn't find what I was looking for. I went through the axis.py and
ticker.py code today, trying to find out how to set the number of
points (ticks) on an axi
If you can find some API documentation for PDFMWord.dll, you can call
its methods with the ctypes python module.
Caleb
--
http://mail.python.org/mailman/listinfo/python-list
Ben,
Thank you.
Caleb
--
http://mail.python.org/mailman/listinfo/python-list
John,
Thank you.
Caleb
--
http://mail.python.org/mailman/listinfo/python-list
Steve
I agree with you. If my vote means anything, I vote against it.
>> The Board realises that this change will be
>> contentious. There are many advantages
>> to making it, however, which we feel will
>> benefit the Python community at large
>> and the PSF membership in particular.
>> Users w
WAIT-
Did I just get caught by an April Fools Joke?
I have a nasty feeling about this :))
C
--
http://mail.python.org/mailman/listinfo/python-list
101 - 110 of 110 matches
Mail list logo