python adds an extra half space when reading froma string or list -- back to the question
davea at davea.name
Tue Jul 2 03:11:32 CEST 2013
On 07/01/2013 05:16 PM, rusi wrote:
> On Tuesday, July 2, 2013 1:32:44 AM UTC+5:30, Dave Angel wrote:
> Yes in this specific instance all this is probably true.
> I believe however, that Joel's intent in reposting this is more global (and important) in its scope, viz:
> If this list persists in the current unhealthy state which it is experiencing, authentic noob questions will get buried in mountains of bullshit.
> Note: I find Joshua's answer fine given the question.
>> If the OP has abandoned it, so should we.
> If you were a noob-OP who asked that question and the result unfolded as it has, what would you do?
Point well-taken. So I'll see what I can do here. I'll put comments on
lines I had to add or change.
finale_line =  #missing initialization
lot_number = 99
first=input("enter first lot: ")
last=input("enter last lot: ")
for lot_number in range(first,last):
for count in range(1,5):
#finale_line2=finale_line #not referenced
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 a," ",
for b in range(1,5):
#print(" "*(a[b]-space_count)),a[b], #dead code
#space_count=a[b]+1 #dead code
Since all the numbers are butted together in the string line_out, the
later logic is iterating over digits, which cannot be bigger than 9. So
the else clause is nonsensical. Even if they were to run, they'd give
> #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
> of strings and got the same results.#
No clue what that means. What numbers are between what lines? And what
is a normal print?
Presumably the intent was to somehow do a variable spacing of those digits.
More information about the Python-list