DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Python (http://www.daniweb.com/forums/forum114.html)
-   -   Text Wrap in Terminal (http://www.daniweb.com/forums/thread166625.html)

elvenstruggle Jan 6th, 2009 10:42 pm
Text Wrap in Terminal
 
Hello, I have a text-based program (non-GUI) that would run solely inside the workspace terminal. Within this program there are hundreds of "print statements" showing really long texts.

e.g.

print "This is a really really really really really really really really really really really really really really really really really really long sentence."

Is there a way (e.g. a class) that I can use to wrap all outputted text (e.g. 70 characters long per line) around the workspace terminal? It would be perfect if I can create a class that runs in the background and wraps the texts automatically without calling it every time I use a print statement.

Thanks a lot!

jlm699 Jan 6th, 2009 11:40 pm
Re: Text Wrap in Terminal
 
Try out this guy

Gribouillis Jan 7th, 2009 2:47 am
Re: Text Wrap in Terminal
 
Quote:

Originally Posted by jlm699 (Post 772442)
Try out this guy

One of the comment of this snippet says that there is a standard module
textwrap
. I think it will do a better job.


All times are GMT -4. The time now is 11:05 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC