Re: turn list of letters into an array of integers

2012-10-24 Thread seektime
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

turn list of letters into an array of integers

2012-10-23 Thread seektime
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: >>> L=['a b a\n','b b a\n'] >>> s=' '.join(L) >>> seq1=('a','b') >