Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'newbie': 0.03; 'string.': 0.04; 'suppress': 0.07; 'python': 0.08; 'subject:show': 0.09; 'wrote:': 0.15; 'assigns': 0.16; 'brackets': 0.16; 'received:192.168.1.40': 0.16; "subject:'.": 0.16; 'variable.': 0.16; 'pm,': 0.16; '>>>': 0.16; '2.x': 0.19; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'assume': 0.23; 'string': 0.26; 'tried': 0.27; "i'm": 0.27; 'url:mailman': 0.27; 'sat,': 0.28; 'script': 0.29; 'idle': 0.29; 'shell': 0.29; 'unicode': 0.29; 'do.': 0.30; 'hi,': 0.31; 'url:listinfo': 0.32; 'print': 0.32; 'list': 0.32; "i've": 0.33; 'to:addr:python-list': 0.34; 'header :User-Agent:1': 0.34; 'there': 0.34; 'appreciated': 0.34; 'probably': 0.35; 'question': 0.35; 'url:python': 0.37; 'useful': 0.37; 'element': 0.37; 'pull': 0.37; 'some': 0.37; 'but': 0.37; 'using': 0.37; 'received:192': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'received:192.168.1': 0.39; 'data': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'received:62': 0.67; 'show': 0.67; '2.7.': 0.84; 'encoding,': 0.84; 'from:addr:t': 0.84; 'stuff:': 0.84 Date: Sun, 24 Jul 2011 03:06:09 +0200 From: Thomas Jollans User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Strings show as brackets with a 'u'. References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: id=5C8691ED Content-Type: text/plain; charset=ISO-8859-1 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311469574 news.xs4all.nl 23904 [2001:888:2000:d::a6]:50281 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10182 On 24/07/11 02:52, Dan Stromberg wrote: > > It's probably a list containing a single unicode string. > > You can pull the first element from the list with n[0]. > > To print a unicode string in 2.x without the u stuff: > > print u'174'.encode('ISO-8859-1') just >>> print u'174' will do. Encoding the string by hand is only useful if Python doesn't know the terminal's encoding, but you do. > > On Sat, Jul 23, 2011 at 5:33 PM, goldtech > wrote: > > > Hi, > > >>> n > [u'174'] > >>> > > Probably newbie question but not sure how suppress the brackets and > the 'u' ? I assume pyhon is telling me it's a unicode string in the n > variable. > > I'm using using Idle on winXP, activestate 2.7. Is there a way to > suppress this and just show 174 in the shell ? > A script reading data and assigns 174 to n via some regex. Links on > this appreciated - I've tried to understand unicode before, will keep > trying...thanks. > > > -- > http://mail.python.org/mailman/listinfo/python-list > >