Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'skip:x 70': 0.09; 'subject:into': 0.09; "'b',": 0.16; "'c',": 0.16; "'d',": 0.16; "'e']": 0.16; "['a',": 0.16; 'subject:make': 0.16; 'do.': 0.18; '>>>': 0.22; '>>>': 0.24; 'message-id:@mail.gmail.com': 0.30; 'maybe': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'more': 0.64 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=vNhMLyERo/lQukhmPeCrpJyeEcBEkm3prs7O6IF9/t0=; b=KNwUx05/1F2wZc+gp82zDUGksZWUQ+EmzwpcI9rLWtbEUlj9BrgMP1x6e4Z42SLAA0 6lyIg6YPnB4kL93bIqOCclhx5znlvfB9YaJ33LQG1O2CaHlz1scPuV8G4u8hASW9PJUS zOxGfZ7baHEh7mnQ8Xg2YBMXqFvTMjtf9lSOm8YgXlL5vw+XVqEuTgTk5ImY/zik3YQP wsT1aaV3qkNwDfSaWWLzvjisrIuN6OLdk/MC+EqpIGghZejkO58yvb4dgafqyPIw5CUA TTHWtwTgG0j4MCJz/XMVXDAEtcqOaPTIL/R74lqZba/DkMSmdNRKnEWg96Y4EmYPtsEn AqWw== MIME-Version: 1.0 X-Received: by 10.152.42.196 with SMTP id q4mr10734639lal.14.1397106889441; Wed, 09 Apr 2014 22:14:49 -0700 (PDT) Date: Thu, 10 Apr 2014 13:14:49 +0800 Subject: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ? From: length power To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c34e8edbc7c404f6a94bbe X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397106891 news.xs4all.nl 2924 [2001:888:2000:d::a6]:43208 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70010 --001a11c34e8edbc7c404f6a94bbe Content-Type: text/plain; charset=ISO-8859-1 >>> x=["a","b",["c","d"],"e"] >>> y=x[2] >>> y ['c', 'd'] >>> x.insert(2,y[0]) >>> x ['a', 'b', 'c', ['c', 'd'], 'e'] >>> x.insert(3,y[1]) >>> x ['a', 'b', 'c', 'd', ['c', 'd'], 'e'] >>> del x[4] >>> x ['a', 'b', 'c', 'd', 'e'] >>> maybe there is a more smart way to do. --001a11c34e8edbc7c404f6a94bbe Content-Type: text/html; charset=ISO-8859-1
>>> x=["a","b",["c","d"],"e"]
>>> y=x[2]
>>> y
['c', 'd']
>>> x.insert(2,y[0])
>>> x
['a', 'b', 'c', ['c', 'd'], 'e']
>>> x.insert(3,y[1])
>>> x
['a', 'b', 'c', 'd', ['c', 'd'], 'e']
>>> del x[4]
>>> x
['a', 'b', 'c', 'd', 'e']
>>>
maybe there is a more smart way to do.
--001a11c34e8edbc7c404f6a94bbe--