Text parsing via regex

rdmurray at bitdance.com rdmurray at bitdance.com
Tue Dec 9 22:05:40 EST 2008


On Mon, 8 Dec 2008 at 16:51, Robert Kern wrote:
> Robocop wrote:
>>  Wow!  Thanks for all the input, it looks like that textwrapper will
>>  work great for my needs.  And thanks for the regex help everyone.
>>  Also, i was thinking of using a list, but i haven't used them much in
>>  python.  Is there anything in python that is equivalent to pushback in
>>  c++ for vectors?
>
> list.append()

Fun with lists:

         >>> l = list()
         >>> l.append('a')
         >>> l
         ['a']
         >>> l.extend(['b', 'c'])
         >>> l
         ['a', 'b', 'c']
         >>> l[1:] = [1, 2, 3]
         >>> l
         ['a', 1, 2, 3]
         >>> l.pop()
         3
         >>> l
         ['a', 1, 2]
         >>> l[:0] = ['z']
         >>> l
         ['z', 'a', 1, 2]

--RDM



More information about the Python-list mailing list