Jan-13-2018, 12:59 PM
I have been working with lists for a while now and I thought it was easy but right now I cannot get it to cooperate.
I have a dictionary full of word patterns as the key and then the list of words as the entry for each key.
I am trying to create a new list if just the entries from one key but it is loading the whole thing like a sting into location 0 instead of 1 word per location in the list. I cannot figure out why.
First I load in my dictionary and functions etc,crate the key I want etc. Everything seems fine so far.
The name of the Dictionary is allPatterns and the key is '0.1.0.2.3.4.5.6.7'.
When I test it, I seem to get the right result. Shown below.
The problem is when I try to make a list out of this data. Let's call it listA.
I have a dictionary full of word patterns as the key and then the list of words as the entry for each key.
I am trying to create a new list if just the entries from one key but it is loading the whole thing like a sting into location 0 instead of 1 word per location in the list. I cannot figure out why.
First I load in my dictionary and functions etc,crate the key I want etc. Everything seems fine so far.
The name of the Dictionary is allPatterns and the key is '0.1.0.2.3.4.5.6.7'.
When I test it, I seem to get the right result. Shown below.
wordPatterns.allPatterns['0.1.0.2.3.4.5.6.7'] ['AMAZINGLY', 'ANAEROBIC', 'ANALOGIES', 'ANALOGUES', 'ANALYZERS', 'ANAPHORIC', 'ANARCHISM', 'ANARCHIST', 'ARACHNIDS', 'BOBWHITES', 'COCKTAILS', 'DEDUCTING', 'DEDUCTION', 'ELECTIONS', 'ELECTRIFY', 'ELECTRONS', 'ELEPHANTS', 'ELEVATION', 'ELEVATORS', 'ERECTIONS', 'EXECUTING', 'EXECUTION', 'EXECUTORS', 'EXEMPLARY', 'EXEMPLIFY', 'EXEMPTING', 'EXEMPTION', 'EXERTIONS', 'GIGABYTES', 'GIGAHERTZ', 'MEMORIALS', 'MOMENTARY', 'MUMBLINGS', 'PAPERINGS', 'POPULATED', 'POPULATES', 'REROUTING', 'SISYPHEAN', 'SUSTAINED', 'TUTORIALS']This is what I would expect.
The problem is when I try to make a list out of this data. Let's call it listA.
listA = [wordPatterns.allPatterns['0.1.0.2.3.4.5.6.7']] >>> listA[0] ['AMAZINGLY', 'ANAEROBIC', 'ANALOGIES', 'ANALOGUES', 'ANALYZERS', 'ANAPHORIC', 'ANARCHISM', 'ANARCHIST', 'ARACHNIDS', 'BOBWHITES', 'COCKTAILS', 'DEDUCTING', 'DEDUCTION', 'ELECTIONS', 'ELECTRIFY', 'ELECTRONS', 'ELEPHANTS', 'ELEVATION', 'ELEVATORS', 'ERECTIONS', 'EXECUTING', 'EXECUTION', 'EXECUTORS', 'EXEMPLARY', 'EXEMPLIFY', 'EXEMPTING', 'EXEMPTION', 'EXERTIONS', 'GIGABYTES', 'GIGAHERTZ', 'MEMORIALS', 'MOMENTARY', 'MUMBLINGS', 'PAPERINGS', 'POPULATED', 'POPULATES', 'REROUTING', 'SISYPHEAN', 'SUSTAINED', 'TUTORIALS'] >>> listA[1]
Error:Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
listA[1]
IndexError: list index out of range
What Gives? Please help.