On Mar 19, 11:43 pm, "Mr. Z" <no...@xspambellsouth.net> wrote: > I'm trying emulate a printf() c statement that does, for example > > char* name="Chris"; > int age=30; > printf("My name is %s", name); > printf("My name is %s and I am %d years old.", %s, %d); > > In other words, printf() has a variable arguement list the we > all know. > > I'm trying to do this in Python... >
| >>> def printf(fmt, *args): | ... import sys | ... sys.stdout.write(fmt % args) | ... | >>> printf("It's a %s %s parrot\n", 'Norwegian', 'blue') | It's a Norwegian blue parrot | >>> HTH, John -- http://mail.python.org/mailman/listinfo/python-list