I am not certain if I understand your problem, but I think you are just
trying to read in a string and create a visable matrix. If that
is true, then may some of the code below will work. This is in no
way elegant.<br>
++++++++++++++++++++++++++++++++++++++++++<br>
<br>
count = 1<br>
width =
2
#the width of your matrix<br>
string="aaaaaaaaaa" #input string to piece up<br>
final=""
#output string<br>
for character in string:<br>
if count == width : <br>
final = "%s%s\n" % (final,character)<br>
count = 1<br>
else:<br>
final = "%s%s" % (final,character)<br>
count += 1<br>
print final<br><br><div><span class="gmail_quote">On 28 Feb 2007 16:06:08 -0800, <b class="gmail_sendername">Ryan K</b> <<a href="mailto:ryankaskel@gmail.com">ryankaskel@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm trying to text wrap a string but not using the textwrap module. I<br>have 24x9 "matrix" and the string needs to be text wrapped according<br>to those dimensions. Is there a known algorithm for this? Maybe some
<br>kind of regular expression? I'm having difficulty programming the<br>algorithm. Thanks,<br>Ryan<br><br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list
</a><br></blockquote></div><br>