pastebin

Paste Search Dynamic
Recent pastes
dept num
  1. import re
  2.  
  3. def f1(data):
  4.         p = re.compile('(?P<dept>[A-Z]{2,3}) (?P<num>[0-9]{3})')
  5.         return p.search(data)
  6.  
  7. obj = f1('CS 101')
  8. dept, num = obj.group('dept'), obj.group('num')
  9.  
  10. print dept
  11. print num
Parsed in 0.007 seconds