David Hutto wrote:
> On Wed, Oct 24, 2012 at 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
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 maki
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 wer
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!
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
> ht
On Wed, Oct 24, 2012 at 9:27 PM, seektime wrote:
> On Tuesday, October 23, 2012 11:07:29 PM UTC-7, Chris Rebert wrote:
>> 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
>> considered somewhat deprecat
On Tuesday, October 23, 2012 11:07:29 PM UTC-7, Chris Rebert wrote:
> On Tue, Oct 23, 2012 at 10:23 PM, 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 Pytho
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
http:
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
On 2012-10-24 07:07, Chris Rebert wrote:
On Tue, Oct 23, 2012 at 10:23 PM, 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:
You mean a Python list. The datatype Python calls an `
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 (lett
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
Chris Rebert於 2012年10月24日星期三UTC+8下午2時07分29秒寫道:
> On Tue, Oct 23, 2012 at 10:23 PM, 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:
>
>
>
> Y
Peter Otten wrote:
Brave new words:
> immortable
should be "immortal"
--
http://mail.python.org/mailman/listinfo/python-list
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() ;)
--
http://mail.python.org/mailm
On Tue, Oct 23, 2012 at 10:23 PM, 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:
You mean a Python list. The datatype Python calls an `array` is very
different and relativ
> 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'
On Wed, Oct 24, 2012 at 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. Here's the code I have so far:
On 2012-10-23, at 10:45 PM, Demian Brecht 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 control over it
On 2012-10-23, at 10:23 PM, seektime 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 in s.
20 matches
Mail list logo