robinsiebler wrote:
> The other thing I failed to mention is that I need to ensure that I
> find the fsType *before* I find the next FontName.
Given these requirements, I'd formulate the script something like this:
f = open(filename)
NUM_LINES_BETWEEN = 7
Fo = '/FontName /ACaslonPro-Semibold'
> The other thing I failed to mention is that I need to ensure that I
> find the fsType *before* I find the next FontName.
found_fontname = False
font_search = '/FontName /ACaslonPro-Semibold'
type_search = '/FSType 8'
for line in file('foo.txt'):
if font_search in line:
if
The other thing I failed to mention is that I need to ensure that I
find the fsType *before* I find the next FontName.
--
http://mail.python.org/mailman/listinfo/python-list
> You omit what you want to do with the results when you find
> them...or what should happen when they both appear on the same
> line (though you hint that they're a couple lines apart, you
> don't define this as a "this is always the case" sort of scenario)
I don't do anything, per se. I just n
> I want to search the file until I find '/FontName /ACaslonPro-Semibold'
> and then jump forward 7 lines where I expect to find '/FSType 8'. I
> then want to continue searching from *that* point forward for the next
> FontName/FSType pair. Unfortunately, I haven't been able to figure out
> how t
I have a batch of files that I am trying to search for specific text in
a specific format. Each file contains several items I want to search
for.
Here is a snippet from the file:
...
/FontName /ACaslonPro-Semibold def
/FontInfo 7 dict dup begin
/Notice (Copyright 2000 Adobe Systems Incorporated.