title: sscanf in Python
body: <p>I'm looking for an equivalent to <code>sscanf()</code> in Python. I want to parse <code>/proc/net/*</code> files, in C I could do something like this:</p>
  
  <pre><code>int matches = sscanf(
          buffer,
          "%*d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %*X %*X:%*X %*X:%*X %*X %*d %*d %ld %*512s\n",
          local_addr, &amp;local_port, rem_addr, &amp;rem_port, &amp;inode);
  </code></pre>
  
  <p>I thought at first to use <code>str.split</code>, however it doesn't split on the given characters, but the <code>sep</code> string as a whole:</p>
  
  <pre><code>&gt;&gt;&gt; lines = open("/proc/net/dev").readlines()
  &gt;&gt;&gt; for l in lines[2:]:
  &gt;&gt;&gt;     cols = l.split(string.whitespace + ":")
  &gt;&gt;&gt;     print len(cols)
  1
  </code></pre>
  
  <p>Which should be returning 17, as explained above.</p>
  
  <p>Is there a Python equivalent to <code>sscanf</code> (not RE), or a string splitting function in the standard library that splits on any of a range of characters that I'm not aware of?</p>