newbie question concerning formatted output
donald.welch at hp.com
Tue Nov 29 21:43:14 CET 2005
Thomas Liesner wrote:
> Hello all,
> i am having some hard time to format the output of my small script. I am
> opening a file which containes just a very long string of hexdata
> seperated by spaces. Using split() i can split this string into single
> words and print them on stdout. So far so good. But i want to print always
> three of them in a single line and after that a linebreak.
> So instead of:
> i'd like to have:
> 3905 3009 0000
> 4508 f504 0000
> 3707 5a07 0000
> This is the codesnippet i am using:
> import string
> inp = open("xyplan.nobreaks","r")
> data = inp.read()
> for words in data.split():
> print words
> Any hints?
Might be more than you need, but I've employed "TextFormatter"
(http://www.faqts.com/knowledge_base/view.phtml/aid/4517) to good effect.
More information about the Python-list