Jul-05-2018, 09:41 AM
so I'm fiddling with lists ... (and yup, new in python)
mylist = ["a", "b", "c"]
where "a,b,c" are lists with some values too ... like
"a" > {"longname", "1234"}
"b" > {"longname", "1223434"}
"c" > {"longnaaame", "12314444223234"}
keyword = "name"
I want my primary list to be checked with unique values on the nested list values.
So in this example the result would be '2' since 'name' occurs in 'a' and in 'b'.
Afterwards I could use len to check.
I'm thinking
(later on I want to check if there is 'one' item in the list ... if so ... do something ... else ... etc.)
mylist = ["a", "b", "c"]
where "a,b,c" are lists with some values too ... like
"a" > {"longname", "1234"}
"b" > {"longname", "1223434"}
"c" > {"longnaaame", "12314444223234"}
keyword = "name"
I want my primary list to be checked with unique values on the nested list values.
So in this example the result would be '2' since 'name' occurs in 'a' and in 'b'.
Afterwards I could use len to check.
I'm thinking
ulist = [] for l in mylist: > for nl in l >> if keyword in nl: >>> ulist.append(l)Makes sense? I hope so. This the way to do so?
(later on I want to check if there is 'one' item in the list ... if so ... do something ... else ... etc.)