gregaryb Posted July 21 Share Posted July 21 (edited) I currently have this declaration: arrayLinksByTrade = [{"strDesc": "GARDENERS", "arrayLinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/gardeners-14621-category-")}, {"strDesc": "CLEANERS", "arraylinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/home-cleaning-13986-category-")}, #{"strDesc": "PAINTERS", "arraylinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/painters-decorators-17302-category-")}, #{"strDesc": "CONCRETERS", "arraylinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/concrete-contractors-34622-category-")}, #{"strDesc": "ARBORISTS", "arraylinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/tree-stump-removal-services-28061-category-")}, #{"strDesc": "PET CARERS", "arraylinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/pet-care-27995-category-")}, #{"strDesc": "GLAZIERS", "arraylinks": DoGetAlphabeticLinks("https://www.yellowpages.com.au/xxxx/glazier-glass-replacement-services-27049-category-")}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, #{"strDesc": "XXXX", "arraylinks": ""}, {"strDesc": "XXXX", "arraylinks": ""}] DoGetAlphabeticLinks(...) simply returns an array of strings It all works just fine! My arrayLinksByTrade contains the following as expected. [{'strDesc': 'GARDENERS', 'arrayLinks': ['https://www.yellowpages.com.au/act/gardeners-14621-category-a1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-b1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-c1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-d1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-e1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-f1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-g1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-h1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-i1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-j1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-k1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-l1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-m1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-n1', 'https://www.yellowpages.com.au/act/gardeners-14621-category-o1', 'https://www.yellowpages.com Then I get to this part of my code: for nJ in range(1, 7): arrayAlphabeticLinkURLs = arrayLinksByTrade[nJ].get("arrayLinks") strTradeDesc = arrayLinksByTrade[nJ].get("strDesc") if (arrayAlphabeticLinkURLs == None) or (strTradeDesc == None): print("ERROR at nJ == " + str(nJ)) So it is iterating through arrayLinksByTrade. Upon the first iteration strTradeDesc contains "GARDENERS" as expected. But arrayAlphabeticLinkURLs contains None WTF is going on here? Why am I getting None. According to the debug watch I have each element of my array DOES contain the key 'arrayLinks' So why can't .get("arrayLinks") find it???? Edited July 21 by gregaryb Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now