Greetings Ben,
: I'm searching line by line for certain tags and then printing the
: tag followed by the word immediately following the tag.
What you are describing is an awful lot like 'grep'. But, of
course, many different sorts of file searching resemble grep.
: So for example, suppose
On Mon, Dec 13, 2010 at 1:55 PM, Ben Ganzfried wrote:
> I'm searching line by line for certain tags and then printing the tag
> followed by the word immediately following the tag.
>
> So for example, suppose I had the following line of text in a file:
>
> mystring = "this is a key
"Ben Ganzfried" wrote
def test(infile, outfile):
for line in infile:
tagIndex = line.find("key")
start = tagIndex + 4
stop = line[start:].find("\t") -1
if tagIndex != -1:
print("start is: ", start)
print("stop is: ", sto
I'm searching line by line for certain tags and then printing the tag
followed by the word immediately following the tag.
So for example, suppose I had the following line of text in a file:
"this is a key test123 noisenoise noise noise noise"
In this example, I would wan