[Tutor] Avoiding repetetive pattern match in re module (fwd)
Adam
adam.jtm30 at gmail.com
Thu Jan 5 22:39:47 CET 2006
On 05/01/06, Danny Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
>
>
>
> ---------- Forwarded message ----------
> Date: Fri, 6 Jan 2006 01:53:41 +0530
> From: Intercodes <intercodes at gmail.com>
> To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
> Subject: Re: [Tutor] Avoiding repetetive pattern match in re module
>
> Hello Danny,
>
> Thanks for the response. The read() and join() method worked like charm. I
> couldn't tune the sets.Set() though. It eliminated duplicates from the
> list,
> but I couldn't find a method in sets to print only the set data ( instead
> I
> get " Set([data1,data2])" when a set object is printed )
How about this
>>> s = set([1,2,2,3,4,3,3,5])
>>> list(s)
[1, 2, 3, 4, 5]
Then it just prints out like a list. Also if the objects in the list are
strings you can use the .join method to turn it into a string.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060105/c2b4d460/attachment-0001.html
More information about the Tutor
mailing list