Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'string.': 0.05; 'see:': 0.07; 'string': 0.09; 'quotes:': 0.09; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'world!': 0.16; 'world!")': 0.16; 'wrote:': 0.18; 'normally': 0.19; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'characters': 0.30; 'forgot': 0.30; 'prints': 0.31; 'could': 0.34; 'no,': 0.35; 'received:84': 0.35; 'clear': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'subject: ': 0.61; "you'll": 0.62; 'subject:Lists': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=ceBcrxzM c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=aoAcgTy3oA8A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=sn-bq25sUEdxUrDAf8QA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Sat, 25 Oct 2014 01:20:53 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: I am out of trial and error again Lists References: <185ea3d5-71d3-4009-8afe-4f0c2b6bbf30@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414196463 news.xs4all.nl 2830 [2001:888:2000:d::a6]:57027 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3685 X-Received-Body-CRC: 1319918104 Xref: csiph.com comp.lang.python:79638 On 2014-10-25 00:57, Seymore4Head wrote: [snip] > Wait! I don't get it. > name="012" > b=list(range(3)) > print (name[1]) > print (b[1]) > 1 > 1 > > I forgot the b > If you print the int 1, you'll see: 1 If you print the string "1", you'll see: 1 Normally you want it to print only the characters of the string. Think how annoying it would be if every time you printed a string it appeared in quotes: >>> print("Hello world!") 'Hello world!' How could you print just the text: Hello world! No, it's better that it prints the characters of the string. One function you can use is repr: x = 1 y = "1" print(repr(x)) print(repr(y)) This will print: 1 '1' OK, now it's clear that x is an int and y is a string.