On 2007-01-22, questions? <[EMAIL PROTECTED]> wrote: > Are there any sprintf in Python? > I know you can print to files(or redefine sys.stout) and later open the > file content. > > Are there similar function to sprintf in C?
No, but you can compose a similar function very easily. def sprintf(format, *objects): return format % tuple(objects) Since strings are immutable it's not convenient to provide a pass-out parameter as in C. If you want to check for errors you'll have to catch the exceptions, rather than inspect the return value as you can in C. -- Neil Cerutti Symphonies of the Romantic era were a lot longer in length. --Music Lit Essay -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list