Re: generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Sayth Renshaw
This seems to work as a starter. def return_files(file_list): """ Take a list of files and return file when called Calling function to supply attributes """ for filename in sorted(file_list): with open(dir_path + filename) as fd: doc =

Re: generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Sayth Renshaw
> The way I'm reading your code, it's not the generator that's the > difference here. Consider these lines: > > > for item in doc['meeting']['race']: > > > > def return_files(file_list): > > for filename in sorted(file_list, *attribs): > > for item in doc([attribs]): > >

Re: generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Chris Angelico
On Sun, Sep 11, 2016 at 10:46 AM, Sayth Renshaw wrote: > Hi > > I want to create a generator function that supplies my calling function a > file, how though do I get the generator to accept attributes in the argument > when called? > > This works not as a generator The

generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Sayth Renshaw
Hi I want to create a generator function that supplies my calling function a file, how though do I get the generator to accept attributes in the argument when called? This works not as a generator for filename in sorted(file_list): with open(dir_path + filename) as fd: doc =