python - Python3.4 : Multiprocessing variable functions -


i running code below using multiprocessing run ticker_list through request , parsing program faster. following code works, slow. not sure correct usage of multiprocessing. if there more efficient way please let me know.

ticker_list = []  open('/home/a73nk-xce/documents/python/sharkfin/sp500_fin/sp_stockchar/ticker.csv', 'r', newline='') csvfile:     spamreader = csv.reader(csvfile)     rows in spamreader:         pass      eachticker in rows:         ticker_list.append(eachticker)  def final_function(ticker):     try:         getfindata.cashdata(ticker_list)       except exception e:         pass  if __name__ == '__main__':     jobs = []     p = mp.process(target=final_function, args=(ticker_list,))     jobs.append(p)     p.start()     p.join()       

if ticker file large (judging path name, may be)

using csv reader waste of time. not suport seek, way can last line

    row in spamreader:         pass 

since after "row" contain last row in file..

you can see here: most efficient way search last x lines of file in python it's possible retrieve last lines in file, , parse csv module afterward..

this save computation time..


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -