I need some smaller lists for API compatibility and I was going along the mental track of this poor guy who was raked for approaching this problem in the wrong way.
Python: Assign each element of a List to a separate Variable
except nobody actually told him how to approach the problem in the correct way so I thought I would ask. What is the best way to assign variables over a split list for this type of task? I have a list of query numbers that I am breaking apart in an orderly nonrandom fashion. I have seen the post
Python: Efficient way to split list of strings into smaller chunks by concatenated size
but that seems like quite unnecessary for my predicament.
here is what I am attempting- this gives me 500 query terms at a time and nobody gets overloaded.
link = pd.read_csv(linkfile, dtype = object)
pmids = list(link['PMID'])
split = [pmids[i:i+500] for i in range(0,len(pmids),500)]
My next thought was to assign variables like split0 to split[0] and so forth, so why is that so wrong?
EDITED: I had a typo somewhere- split[0] functioned perfectly in my query