Formatted Printing:Boolean Issue
<p>The purpose of this piece of code is to take in a string and print it out in a specific format. For instance, given:</p>

<pre><code>s = "Hello"
</code></pre>

<p>The program should print out:</p>

<pre><code>+---+---+---+---+---+
| H | e | l | l | o |
+---+---+---+---+---+
</code></pre>

<p>If the size of the string is greater than the column size of the console, it's then supposed to print out the string in this format:</p>

<pre><code>+---+---+---+---+---+
| H | e | l | l | o |
+---+---+---+---+---+
| H | e | l | l | o |
+---+---+---+---+---+
| H | e | l | l | o |
+---+---+---+---+---+
| H | e | l | l | o |
+---+---+---+---+---+
</code></pre>

<p>Unfortunately, the second condition doesn't work and I can't seem to figure out why.</p>

<p>Here's my code:</p>

<pre><code>import os

s = "Hello"*20
(consoleRows,consoleCol)=os.popen('stty size','r').read().split()
top = outer = "+---"*len(s)+'+'+'\n'
for i in range(len(s)):
    outer += "| "+s[i]+" "

outer += '|\n'
outer += top[:len(top)-1]

split = outer.split('\n')
if(len(split[0]) &gt; consoleCol): #problem lies on this line. Even though the size of  
    outer = outer.split('\n') #split[0] is greater than consoleCol the if statement  
    beg = 0   #isn't entered.                                                        
    size = consoleCol
    print(outer[0][beg:size])
    while(size &lt; len(outer[0])):
        print(outer[1][beg:size]);
        print(outer[2][beg:size]);
        beg = size
        size += size
else:
    print(outer)
</code></pre>

<p>Can anyone see what my problem is? I printed out the size of outer[0] and of consoleCol. len(output[0]) is greater than consoleCol.</p>
