Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'attributes': 0.05; 'arguments.': 0.09; 'etc...': 0.09; 'subject:parsing': 0.09; 'tuple': 0.09; 'from:addr:free.fr': 0.16; 'received:free.fr': 0.16; 'splitted': 0.16; 'command': 0.19; 'sfxlen:2': 0.19; 'to:2**1': 0.21; 'parse': 0.23; 'cheers': 0.23; 'tried': 0.27; 'somebody': 0.28; 'all,': 0.28; 'gather': 0.29; 'module': 0.30; 'list:': 0.31; "skip:' 10": 0.32; 'to:addr:tutor': 0.32; 'properties': 0.33; 'to:addr:python-list': 0.34; 'header:User- Agent:1': 0.34; 'to:no real name:2**1': 0.37; 'experiences': 0.37; 'but': 0.37; 'received:192': 0.38; 'to:addr:python.org': 0.39 Date: Wed, 27 Jul 2011 21:30:57 +0200 From: Karim User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: tutor@python.org, python-list@python.org Subject: shlex parsing Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311795072 news.xs4all.nl 23978 [2001:888:2000:d::a6]:43276 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10396 Hello All, I would like to parse this TCL command line with shlex: '-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG' And I want to get the splitted list: ['-option1', '[get_rule A1 B2]', '-option2', '$VAR', '-option3', 'TAG'] Then I will gather in tuple 2 by 2 the arguments. I tried to the shlec properties attributes 'quotes', 'whitespace', etc... But I make 'choux blanc'. If somebody has complex experiences with this module I am in. Cheers Karim