Newbie advice for string fromatting

gt gtewalt at earthlink.net
Wed Jul 2 10:42:51 EDT 2003


O.k., four days into playing with python
and I have a little problem that I would like 
to get some feedback on.
( as far as the best way to go about it )

Basically, just a little Mad-Libs type script.

Something like:

libs = ["adverb", "noun", "verb", "tool"]
words = {a:j, n:j, v:j, t:j}
for x in libs:
       print "Enter a ", x, ": ",
       words[j] = raw_input()
print "The %s %s %s with a %s." % (a, n, v, t)

What is the most efficient way to do something like this?




More information about the Python-list mailing list