Python and XML help
Fredrik Lundh
fredrik at pythonware.com
Sat Jul 27 14:06:50 EDT 2002
Clark Evans wrote:
> For a simple properties list like this you could use YAML
> instead of python... it'd be alot easier.
$ more clarkbot.py
...
hitlist = ["XML", "xml", "type", "marshal", "pickle", ...]
def process_message(text):
words = text.split()
for word in hitlist:
if word in words:
break
else:
if random.random() < 0.98:
return
message = quote_relevant_parts(text)
message = message + random.choice([
"You want YAML",
"Hey, use my own YAML standard instead",
"This reminds me of YAML",
"Almost sounds like YAML",
...
"Two YAML were walking across the street",
]
)
post(message + yaml_footer)
...
More information about the Python-list
mailing list