Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.058 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.01; 'else:': 0.03; '")': 0.09; 'subject:extra': 0.09; 'subject:string': 0.09; 'subject:question': 0.10; 'def': 0.12; 'thread': 0.14; '#this': 0.16; 'subject:when': 0.16; 'subject:python': 0.16; 'to:name :python-list@python.org': 0.22; 'print': 0.22; 'copied': 0.24; 'skip:l 30': 0.24; 'question': 0.24; 'compare': 0.26; 'skip:" 30': 0.26; 'skip:" 20': 0.27; 'tried': 0.27; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'lines': 0.31; 'skip:& 30': 0.33; 'subject:the': 0.34; 'received:google.com': 0.35; 'list': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'skip:n 30': 0.60; 'subject:back': 0.60; 'numbers': 0.61; 'first': 0.61; 'skip:n 10': 0.64; 'number:': 0.66; 'due': 0.66; 'between': 0.67; '"white': 0.84; 'subject:space': 0.84; 'continue.': 0.91; 'joel': 0.91; '"white': 0.93 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=uw/Rc89b/1wKaFcNYLxEgRYoyvx/Xt6KLzl5nY7fVHM=; b=koBuG/nvT3l32kgIkkvk8ECiYLyU0QpEcWU2LhGaXojDBR06bycf2IIoelB40bnC4G nxorKz53yjaonn2JoRZ2LN1j5z3aqV2QmWtwgN+I7EgsL/H+4E+dDu2OTaKe7bW9YPEg k58uyqb3i6F1laVEyQoteTOwCMP9uagOGXtsCRvbsEOS8ZVJIffa7/q7TyqBvYzbPz5g Gp7YQXL9b2Ul5hP2OmlCGWWTj3jvWmtMmV6TbAbFzaC6v/lXuvjq6zhjIp2PdmKztRGr uX9Ym5FiUsG2ftAFYTvgToL4jOEc1Ko9cNbgTzUZ0kCh9o224IiM2TBZ0Cm0U7nEDnwb jWCQ== MIME-Version: 1.0 X-Received: by 10.58.181.225 with SMTP id dz1mr10180622vec.95.1372707132736; Mon, 01 Jul 2013 12:32:12 -0700 (PDT) Date: Mon, 1 Jul 2013 15:32:12 -0400 Subject: python adds an extra half space when reading froma string or list -- back to the question From: Joel Goldstick To: "python-list@python.org" Content-Type: multipart/alternative; boundary=047d7b6050200716b504e07849c6 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: 235 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372707140 news.xs4all.nl 15910 [2001:888:2000:d::a6]:48126 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49586 --047d7b6050200716b504e07849c6 Content-Type: text/plain; charset=UTF-8 I copied the original question so that the rant on the other thread can continue. Let's keep this thread ontopic number_drawn=() def load(lot_number,number_drawn): first=input("enter first lot: ") last=input("enter last lot: ") for lot_number in range(first,last): line_out=str(lot_number) for count in range(1,5): number_drawn=raw_input("number: ") line_out=line_out+(number_drawn) print line_out finale_line.append(line_out) finale_line2=finale_line load(lot_number,number_drawn) print finale_line print(" "*4), for n in range(1,41): print n, #this is to produce a line of numbers to compare to output# for a in finale_line: print"\n", print a[0]," ", space_count=1 for b in range(1,5): if int(a[b])<10: print(" "*(int(a[b])-space_count)),int(a[b]), space_count=int(a[b]) else: print(" "*(a[b]-space_count)),a[b], space_count=a[b]+1 number_drawn=() def load(lot_number,number_drawn): first=input("enter first lot: ") last=input("enter last lot: ") for lot_number in range(first,last): line_out=str(lot_number) for count in range(1,5): number_drawn=raw_input("number: ") line_out=line_out+(number_drawn) print line_out finale_line.append(line_out) finale_line2=finale_line load(lot_number,number_drawn) print finale_line print(" "*4), for n in range(1,41): print n, #this is to produce a line of numbers to compare to output# for a in finale_line: print"\n", print a[0]," ", space_count=1 for b in range(1,5): if int(a[b])<10: print(" "*(int(a[b])-space_count)),int(a[b]), space_count=int(a[b]) else: print(" "*(a[b]-space_count)),a[b], space_count=a[b]+1 this generates enter first lot: 1 enter last lot: 4 number: 2 number: 3 number: 4 number: 5 12345 number: 1 number: 2 number: 3 number: 4 21234 number: 3 number: 4 number: 5 number: 6 33456 ['12345', '21234', '33456'] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 2 3 4 5 2 1 2 3 4 3 3 4 5 6 >#as you can see many numbers are between the lines of a normal print# #I thought this was due to "white space" int he format .So I tried a list of strings and got the same results.# -- Joel Goldstick http://joelgoldstick.com --047d7b6050200716b504e07849c6 Content-Type: text/html; charset=UTF-8
I copied the original question so that the rant on the other thread can continue.  Let's keep this thread ontopic

number_drawn=() def load(lot_number,number_drawn): first=input("enter first lot: ") last=input("enter last lot: ") for lot_number in range(first,last): line_out=str(lot_number) for count in range(1,5): number_drawn=raw_input("number: ") line_out=line_out+(number_drawn) print line_out finale_line.append(line_out) finale_line2=finale_line load(lot_number,number_drawn) print finale_line print(" "*4), for n in range(1,41): print n, #this is to produce a line of numbers to compare to output# for a in finale_line: print"\n", print a[0]," ", space_count=1 for b in range(1,5): if int(a[b])<10: print(" "*(int(a[b])-space_count)),int(a[b]), space_count=int(a[b]) else: print(" "*(a[b]-space_count)),a[b], space_count=a[b]+1 number_drawn=() def load(lot_number,number_drawn): first=input("enter first lot: ") last=input("enter last lot: ") for lot_number in range(first,last): line_out=str(lot_number) for count in range(1,5): number_drawn=raw_input("number: ") line_out=line_out+(number_drawn) print line_out finale_line.append(line_out) finale_line2=finale_line load(lot_number,number_drawn) print finale_line print(" "*4), for n in range(1,41): print n, #this is to produce a line of numbers to compare to output# for a in finale_line: print"\n", print a[0]," ", space_count=1 for b in range(1,5): if int(a[b])<10: print(" "*(int(a[b])-space_count)),int(a[b]), space_count=int(a[b]) else: print(" "*(a[b]-space_count)),a[b], space_count=a[b]+1 this generates <type 'list'> enter first lot: 1 enter last lot: 4 number: 2 number: 3 number: 4 number: 5 12345 number: 1 number: 2 number: 3 number: 4 21234 number: 3 number: 4 number: 5 number: 6 33456 ['12345', '21234', '33456'] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 2 3 4 5 2 1 2 3 4 3 3 4 5 6 >#as you can see many numbers are between the lines of a normal print# #I thought this was due to "white space" int he format .So I tried a list of strings and got the same results.#


--
--047d7b6050200716b504e07849c6--