perl to python, case + regular expression question

Andrew Dalke dalke at acm.org
Wed Jul 26 14:20:49 EDT 2000


Carsten Gaebler:
>get() only works with dictionaries, not with sequences.


Completely correct.  I don't know where my brain was.  (Actually,
it was in bed at the time but my finger's weren't :)

How about ...

words = string.split(input_line)
if words:
  if words[0] == "log":
    log_entry_num = int(words[2])
  elif words[0] == "run":
    run_number = int(words[2])
    timestamp = string.join(words[4:])

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list