From 3874afbaf8830e98f4d01c3cc19452d74fdb94bf Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 5 Jul 2010 17:56:44 -0700 Subject: [PATCH] let print_ take multiple arguments (just like print) -- thanks, Marty! --- beets/ui/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 6fb07ef1e..2d06737fc 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -41,11 +41,16 @@ class UserError(Exception): # Utilities. -def print_(txt=''): +def print_(*strings): """Like print, but rather than raising an error when a character is not in the terminal's encoding's character set, just silently replaces it. """ + if strings: + if isinstance(strings[0], unicode): + txt = u' '.join(strings) + else: + txt = ' '.join(strings) if isinstance(txt, unicode): encoding = locale.getdefaultlocale()[1] txt = txt.encode(encoding, 'replace')