John Posner wrote:
On 3/2/2010 10:19 AM, Roy Smith wrote:
Somewhat sadly, in my case, I can't even machine process the header
file. I don't, strictly speaking, have a header file. What I have is
a PDF which documents what's in the header file, and I'm manually re-
typing the data out of that. Sigh.
Here's an idea, perhaps too obvious, to minimize your keystrokes:
1. Create a text file with the essential data:
XYZ_FOO 0 The foo property
XYZ_BAR 1 The bar property
XYZ_BAZ 2 reserved for future use
2. Use a Python script to convert this into the desired code:
declare('XYZ_FOO', 0, "The foo property")
declare('XYZ_BAR', 1, "The bar property")
declare('XYZ_BAZ', 2, "reserved for future use")
Note:
>>> s
'XYZ_FOO 0 The foo property'
>>> s.split(None, 2)
['XYZ_FOO', '0', 'The foo property']
You might be able to reduce your typing by copy-and-pasting the relevant
text from the PDF into an editor and then editing it.
--
http://mail.python.org/mailman/listinfo/python-list