Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.090 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'example:': 0.03; 'message- id:@web.de': 0.16; 'subject:list': 0.18; 'charset:iso-8859-15': 0.28; 'lists': 0.28; 'problem': 0.28; 'second': 0.29; 'from:addr:web.de': 0.30; 'list': 0.32; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'totally': 0.35; 'example,': 0.37; 'list,': 0.37; 'but': 0.37; 'something': 0.37; 'sets': 0.39; 'to:addr:python.org': 0.39; 'received:172.20': 0.73; 'sender:addr:web.de': 0.84 Date: Tue, 16 Aug 2011 01:26:54 +0200 From: Johannes User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: python-list@python.org Subject: testing if a list contains a sublist X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: dajo.mail@web.de X-Sender: dajo.mail@web.de X-Provags-ID: V01U2FsdGVkX1+2G0b3MP/MTlhsi8XYvpqmyNmITFRBGs39sUuK Q9y4iRcAXWzpj5shYSay/PxUHYyW0nTDS6KaLDczSe0aT9xLzJ jhMmXVKuc= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313450819 news.xs4all.nl 23854 [2001:888:2000:d::a6]:33080 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11480 hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] -> l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] -> l1 is not contained in l2 l1 = [1,2,3], l2 = [1,3,5,7] -> l1 is not contained in l2 my problem is the second example, which makes it impossible to work with sets insteads of lists. But something like set.issubset for lists would be nice. greatz Johannes