The Art of Pickling: Binary vs Ascii difficulties

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Oct 14 17:38:25 EDT 2004


>>>>> "Andrew" == Andrew Dalke <adalke at mindspring.com> writes:

    Andrew> Standards wonk that I am, I was curious about this.  I've

Well, if you are a standards wonk and emacs user, you might have fun
with this little bit of python and emacs code.  If you place rfc.py in
your PATH

#!/usr/bin/env python
# Print an RFC indicated by a command line arg to stdout
#   > rfc.py 822

import urllib, sys

try: n = int(sys.argv[1])
except:
    print 'Example usage: %s 822' % sys.argv[0] 
    sys.exit(1)

print urllib.urlopen('http://www.ietf.org/rfc/rfc%d.txt' % n).read()


and add this function to your .emacs

;;** RFC
(defun rfc (num)
  "Insert RFC indicated by num into buffer *RFC<num>*"
  (interactive "sRFC: ")
  (shell-command 
    (concat "rfc.py " num)
    (concat "*RFC" num "*")))


You can get rfc's in your emacs buffer by doing

  M-x rfc ENTER 20 ENTER

And now back you our regularly scheduled work day.

JDH



More information about the Python-list mailing list