<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hi Grant,<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">&gt; I'm a newbie and this is my first script submission to this email list.<br>&gt; I was able to parse out the jobs list into a string: "jobs = [ . . ."<br>&gt; However, I can't make python interpret that string as the command "jobs = [ some list]"
<br><br>There are ways of doing that but unless you are specifically doing that <br>as a challenge it is much easier just to import your py file. When you <br>import a module Python will evaluate the contents as Python code <br>and the variables in the module become available to you. That way <br>you don't need to read the file manually.<br><br>The only caveat with the import method is that Python needs to find <br>our module so it must either be in the same folder as your python <br>script or the folder must be in the sys.path variable. Thus for a general solution:<br><br>import sys<br>sys.path.append('the/folder/where/myfile/lives')<br>import myfile&nbsp;&nbsp;&nbsp; # no .py<br>jobs = myfile.jobs<br><br>And that should be it. jobs should now contain the same list that <br>was in your myfile.py<br><br><br>However if you do want todo it the hard way:<br><br>&gt; #SCRIPT<br>&gt; # open the file and assign it to the variable "thefile"<br>&gt; thefile =
 open("/home/banter/Desktop/mylist.py") <br><br>OK To here but....<br><br>&gt; # read the file and assign it to the variable "read_thefile"
<br>&gt; read_thefile = file.read(thefile)<br>&gt; # make the file's contents into a string<br>&gt; string_thefile = str(read_thefile)<br><br>this should simply be<br><br>data = thefile.read()<br><br># split that string up into a list<br>splitlist = data.split()<br><br>
# index the list to find the placement of the word 'jobs'<br>it_starts = splitlist.index('jobs')<br><br># index the list to find the placement of the ']'<br><br>OK Now its getting rather messy. Its probably easier to take a <br>completely different approach, something like(untested code!):<br><br>started = False<br>for line in file(myfile.py'):<br>&nbsp;&nbsp;&nbsp;&nbsp; if 'jobs' in line and not started:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jobs = []<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; started = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue<br>&nbsp;&nbsp;&nbsp; if ']' not in line and started:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jobs.append(line')<br>&nbsp;&nbsp;&nbsp; else: break<br><br>&gt; are you getting a duplicate copy of this email? <br>&gt; I am CCing 
tutor@python and TOing you . . .<br><br>Yes that's the correct procedure. Use ReplyAll in your mail tool <br>and all should be well. (although some folks would prefer if you <br>just reply to the list, it's a bit of a hot topic! :-)<br><br>HTH,<br><br>Alan G.<br></div></div></div><br>
      Inbox cluttering up with junk? Clean up with <a href="http://us.rd.yahoo.com/mailuk/taglines/gmail/clean_up/*http://us.rd.yahoo.com/evt=48525/*http://uk.docs.yahoo.com/mail/isp_targeting.html">Yahoo! Mail</a>.</body></html>