padding strings

Roy Smith roy at popmail.med.nyu.edu
Thu Apr 29 14:02:40 EDT 1999


Given a string, I want to generate another string which is exactly N
characters long.  If the first string is less than N, I want to blank-pad
it.  If the first string is greater than N, I want to truncate it.

What's the most straight-forward way to do that?

-- 
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine





More information about the Python-list mailing list