On Thu, 25 Oct 2012 07:47:48 +0200, Peter Otten wrote:
Wasn't there a Monty Python sketch where a man carrying a parrot in a
cage comes into a shop full of stuffed animals and complains: No, I
don't admire the taxidermist for making that parrot look like it were
alive -- that beast bit me!
I
Steven D'Aprano wrote:
On Thu, 25 Oct 2012 07:47:48 +0200, Peter Otten wrote:
Wasn't there a Monty Python sketch where a man carrying a parrot in a
cage comes into a shop full of stuffed animals and complains: No, I
don't admire the taxidermist for making that parrot look like it were
On 25/10/2012 09:25, Peter Otten wrote:
Steven D'Aprano wrote:
On Thu, 25 Oct 2012 07:47:48 +0200, Peter Otten wrote:
Wasn't there a Monty Python sketch where a man carrying a parrot in a
cage comes into a shop full of stuffed animals and complains: No, I
don't admire the taxidermist for
David Hutto wrote:
On Wed, Oct 24, 2012 at 1:23 AM, seektime michael.j.kra...@gmail.com wrote:
Here's some example code. The input is a list which is a matrix of
letters:
a b a
b b a
and I'd like to turn this into a Python array:
1 2 1
2 2 1
so 1 replaces a,
Of course, if you want these to be ints, then you can either change the
format of your int list, or map(int, list_) if you don't have control over it.
Ugh, I'm tired. Shouldn't map it, the conversion should be done in the list
comprehension to avoid a needless second list iteration.
K, I'm
On Tue, Oct 23, 2012 at 10:23 PM, seektime michael.j.kra...@gmail.com wrote:
Here's some example code. The input is a list which is a matrix of letters:
a b a
b b a
and I'd like to turn this into a Python array:
You mean a Python list. The datatype Python calls an `array` is very
Chris Rebert wrote:
line.strip().split()
No need to strip() if you are going to split on whitespace:
line = a b c \n
line.split() == line.strip().split()
True
Lest the new idiom takes on while you are bravely fighting the immortable
readlines() ;)
--
Peter Otten wrote:
Brave new words:
immortable
should be immortal
--
http://mail.python.org/mailman/listinfo/python-list
Chris Rebert於 2012年10月24日星期三UTC+8下午2時07分29秒寫道:
On Tue, Oct 23, 2012 at 10:23 PM, seektime michael.j.kra...@gmail.com wrote:
Here's some example code. The input is a list which is a matrix of
letters:
a b a
b b a
and I'd like to turn this into a Python array:
On 10/24/12 1:03 PM, 8 Dihedral wrote:
The list in python is a list of valid python objects.
For the number crunching part, please use arrays in numarray and scipy.
Your bot's database is laughably out of date.
--
Robert Kern
I have come to believe that the whole world is an enigma, a
On 10/24/2012 1:23 AM, seektime wrote:
Here's some example code. The input is a list which is a matrix of letters:
a b a
b b a
and I'd like to turn this into a Python array:
1 2 1
2 2 1
so 1 replaces a, and 2 replaces b.
If you are going to replace single characters
On 2012-10-24 07:07, Chris Rebert wrote:
On Tue, Oct 23, 2012 at 10:23 PM, seektime michael.j.kra...@gmail.com wrote:
Here's some example code. The input is a list which is a matrix of letters:
a b a
b b a
and I'd like to turn this into a Python array:
You mean a Python list. The
Le mercredi 24 octobre 2012 07:23:11 UTC+2, seektime a écrit :
Here's some example code. The input is a list which is a matrix of letters:
a b a
b b a
and I'd like to turn this into a Python array:
1 2 1
2 2 1
so 1 replaces a, and 2 replaces b. Here's
On 2012-10-24, at 10:27 AM, wxjmfa...@gmail.com wrote:
Not so sure what you mean by an array of integers.
I wasn't entirely sure about that either. I assumed given the subject that it
was just a 1-D array and could then be accessed by arr[(y * width) + x].
Demian Brecht
@demianbrecht
On Tuesday, October 23, 2012 11:07:29 PM UTC-7, Chris Rebert wrote:
On Tue, Oct 23, 2012 at 10:23 PM, seektime michael.j.kra...@gmail.com wrote:
Here's some example code. The input is a list which is a matrix of
letters:
a b a
b b a
and I'd like to turn this into
On Wed, Oct 24, 2012 at 9:27 PM, seektime michael.j.kra...@gmail.com wrote:
On Tuesday, October 23, 2012 11:07:29 PM UTC-7, Chris Rebert wrote:
snip
P.S.: I'm guessing you obtained `L` from file.readlines() or similar;
it is worth noting for future reference that the readlines() method is
Dennis Lee Bieber wrote:
On Wed, 24 Oct 2012 11:04:38 +0200, Peter Otten __pete...@web.de
declaimed the following in gmane.comp.python.general:
Peter Otten wrote:
Brave new words:
immortable
should be immortal
Readlines() isn't immortal... It's a lich
On 2012-10-23, at 10:23 PM, seektime michael.j.kra...@gmail.com wrote:
My question is how can I turn seq into a python array?
Something like this perhaps?:
alpha = ('a', 'b')
numeric = ('1', '2')
L = ['a b a\n', 'b b a\n']
s = ' '.join(L)
d = dict(zip(alpha, numeric))
list_ = [d[c] for c
On 2012-10-23, at 10:45 PM, Demian Brecht demianbre...@gmail.com wrote:
list_ = [d[c] for c in s.strip('\n').split()]
list_
['1', '2', '1', '2', '2', '1']
Of course, if you want these to be ints, then you can either change the format
of your int list, or map(int, list_) if you don't have
On Wed, Oct 24, 2012 at 1:23 AM, seektime michael.j.kra...@gmail.com wrote:
Here's some example code. The input is a list which is a matrix of letters:
a b a
b b a
and I'd like to turn this into a Python array:
1 2 1
2 2 1
so 1 replaces a, and 2 replaces b. Here's the code
20 matches
Mail list logo