On Sep 5, 2017, at 10:42 AM, Walt Farrell <[email protected]> wrote:
> 
> Python has Unicode functions that let you examine the characteristics of the 
> characters within a string so you can figure out the proper length when 
> printed, but I'm not aware of anything built-in like a print function that 
> does that automatically. It would be handy.

In Python 3, at least, the built-in substitution facility can handle it as-is:

Python 3.5.4 (default, Aug 12 2017, 14:31:52) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def fmtprt(hw):
...     print("%-22s+++\n" % hw)
... 
>>> fmtprt("Hello, world!")
Hello, world!         +++

>>> fmtprt("Привет мир.")
Привет мир.           +++

>>> fmtprt("Bonjour le monde.")
Bonjour le monde.     +++

>>> 


-- 
Pew, Curtis G
[email protected]
ITS Systems/Core/Administrative Services


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to