Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Question on List processing Date: Tue, 26 Apr 2016 11:49:28 -0400 Lines: 19 Message-ID: References: <571e47aa$0$1588$c3e8da3$5496439d@news.astraweb.com> <594d024b-7880-4d45-911e-342ec90ac54c@googlegroups.com> <1461685768.2496584.590158745.357656B9@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de NKThiCqApxaj6XyzwBy0/AlKGxUtUdDHWKcXNQ7AU7Dg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.03; 'subject:Question': 0.05; 'strings.': 0.07; 'received:internal': 0.09; '\'"\'': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:compute4.internal': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'string': 0.17; 'example.': 0.18; 'skip:l 30': 0.18; 'trying': 0.22; 'bit': 0.23; '(or': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'function': 0.28; "skip:' 10": 0.28; 'skip:u 20': 0.28; 'values': 0.28; 'skip:( 20': 0.28; "can't": 0.32; 'subject:List': 0.33; 'tue,': 0.34; 'something': 0.35; 'skip:i 20': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'turn': 0.37; 'received:66': 0.38; 'to:addr:python.org': 0.40; 'still': 0.40; 'header:Message-Id:1': 0.61; 'email addr:gmail.com': 0.62; "they're": 0.66; '26,': 0.72; 'indicator': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=+HoRj58gvrRvZIPvRHS3+RWlAQ4=; b=w0ugwJ +3P1p40nzoZ4WQoAwcYhwcrQITxA3Z2upfPglCe1zvED8qPgDkS/dkMPVo3P8vzT NqtPDyshx1Sq44DE/swp1M5S0SvDIvbn6Wjzec7YAfCtfqSJ9lvd+ZDvzCpndgZj FkHWN4X32ifxbK6hpgilkg4AbARsVOdnn0YjI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=+HoRj58gvrRvZIP vRHS3+RWlAQ4=; b=KapECRtyyAC/rdxT4Z6eHBOlmS5+bXYZrN3EHHnc6ZpxDZN 2k9V7LVhdVXohIonoa5C+vxXUc+xJC0btochZu1X34P4pwssKqrPDMpnFFlufrkU G5k4pgAAHtJqwPrifqxY0KLTGobiMTFM/nR8wAHuYx2sFfbzJBFuSeY3uoTA= X-Sasl-Enc: K0RwaWBl8bX6eRwgRsgGE/b0lG1WSdXYVzFwsnCNH5j0 1461685768 X-Mailer: MessagingEngine.com Webmail Interface - ajax-b462e126 In-Reply-To: <594d024b-7880-4d45-911e-342ec90ac54c@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1461685768.2496584.590158745.357656B9@webmail.messagingengine.com> X-Mailman-Original-References: <571e47aa$0$1588$c3e8da3$5496439d@news.astraweb.com> <594d024b-7880-4d45-911e-342ec90ac54c@googlegroups.com> Xref: csiph.com comp.lang.python:107661 On Tue, Apr 26, 2016, at 11:38, subhabangalore@gmail.com wrote: > I am trying to send you a revised example. > list1=[u"('koteeswaram/BHPERSN engaged/NA ','class1')", > u"('koteeswaram/BHPERSN is/NA ','class1')"] > > [('koteeswaram/BHPERSN engaged/NA ','class1'), > ('koteeswaram/BHPERSN is/NA ','class1')] > > I tried to make it as follows, > list2=[] > for i in list1: > a1=unicodedata.normalize('NFKD', i).encode('ascii','ignore') > a2=a1.replace('"',"") > list2.append(a2) I think you're still a bit confused. The values don't actually contain '"' (or 'u'), that's just an indicator that they're strings. You can't turn a string into something else just by removing the quotes. Look at the ast.literal_eval function as others have recommended.