O'Reilly logo

Text Processing with Ruby by Rob Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting Output with printf

Until now we’ve been outputting simple strings in a simple way. But if our output is destined to be read by a human being, we’re going to need something a bit better.

Very often, when doing data analysis and reporting, the data we’re producing isn’t for our own benefit. It’s destined for the marketing department, for sales, for executives—most of whom would run a mile rather than view output on the command line.

But outputting to the screen is such a cheap thing to do, in terms of development time, that it’s often the medium of first resort. Debugging information, programs that are used by developers, and many other applications will need to output to the terminal. Learning to make that output readable is a useful ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required