Python list reuse

The class element has a member function of function (), which returns a list of strings. The Dictionary class has an element of a member function () that returns a list of elements. dict is an example of a dictionary. I want to check if all characters in all lines in all dict, ASCII elements are. I tried

all(ord(ch) < 128 for ch in s for s in item.text() for item in dict.items())

This gives the error message "global name" is undefined. What is the right way?

+5
source share
1 answer

The order of the sentences forshould be the other way around. The innermost loop comes last, the very first loop comes first.

all(ord(ch) < 128 for item in dict.items() for s in item.text() for ch in s)
+5
source

All Articles