r/pythonhelp • • Oct 26 '20

Python Parsing help

Hey all,
I am very new to python and basically have a project with text files. I want to store the first word in a line, and then search for that word in another file. Then, once I find the line that contains that word, I want to print specific words from the line (which is separated by whitespaces) into another file.

For example, the first word in my first line of my first file is "bird". I then search for the line that contains "bird" in my second file (assuming only one does) and I get the words that are between the 4th and 5th space in that line and print it in another file.

I do know the basic of stripping line and reading/writing files, but I do not know how to basically make the for loop part of get the word between specific spaces. Anything helps, sorry I am a noob.

Thank you in advance!

2 Upvotes

4 comments sorted by

View all comments

0

u/itamarc137 Oct 29 '20

I recommend this discord server: https://discord.gg/3Mp8Vt You will eaisly get help there!