Re: regular expression problem
- From: "alex23" <wuwei23@xxxxxxxxx>
- Date: 31 May 2005 01:54:33 -0700
borges2003xx@xxxxxxxx wrote:
> hi everyone
> there is a way, using re, to test (for es) in
> a=[a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14] if a list b is
> composed by three "sublists" of a separated or not by elements.
Heya,
Is there any particular reason why you need to use re?
If you're using Python 2.3 or greater, the sets module might be easier
to deal with here:
>>> from sets import Set
>>> a = Set([1,2,3,4,5,6,7,8,9,10,11,12,13,14])
>>> b = Set([2,3,4,7,8,12,13])
>>> b.issubset(a)
True
>>> b = Set([1,2,5,14])
>>> b.issubset(a)
True
>>> b = Set([3,7,23,200])
>>> b.issubset(a)
False
Sets are unsorted, I'm uncertain if that's a requirement for you.
Hope this helps.
-alex23
.
- Follow-Ups:
- Re: regular expression problem
- From: borges2003xx@xxxxxxxx
- Re: regular expression problem
- References:
- regular expression problem
- From: borges2003xx@xxxxxxxx
- regular expression problem
- Prev by Date: Re: plotting with Python
- Next by Date: Re: Stupid Newbie Question Concerning CGI and Reading Forward Slashes
- Previous by thread: regular expression problem
- Next by thread: Re: regular expression problem
- Index(es):
Relevant Pages
|