Python: Get file path from a text file?

My suggested approach is to parse the file as a general configuration file, and store things that look like assignments. If you have other weird stuff going on in your file, this may not work, but I think it will work here.

My suggested approach is to parse the file as a general configuration file, and store things that look like assignments. If you have other weird stuff going on in your file, this may not work, but I think it will work here. Myvars = {} # iterate through all the lines for line in open('SampleText.

Txt').readlines(): # skip this line if it doesn't look like an assignment if not '=' in line: continue # split it into left and right pieces left, right = line. Split('=', 1) # keep it around in a dictionary myvarsleft.strip() = right.strip() # now you can query it to get stuff: myvars'efgh' # returns /home/user/targetfile1.txt.

Thanks! Trying in progress. .. – Ezylryb Oct 7 at 3:26 Yeah~!

Success! – Ezylryb Oct 7 at 3:37.

You need the ConfigParser module: docs.python.org/library/configparser.html It parses files that look like this. Not knowing your exact situation, I can't be sure.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions