0

I was trying to use any to do a match of keywords to a string (example below taken from another SO question) as below. For some reason it runs fine in django shell as well as python but when I run it in pdb, it gives me an error. Am I missing something here ?

(Pdb) good_data2 = ['hey, man', 'whats up']

(Pdb) s1 = "\n".join(good_data2)

(Pdb) s1
'hey, man\nwhats up'

(Pdb) keywords = ['world', 'he']

(Pdb) any( k in s1 for k in keywords )
*** NameError: global name 's1' is not defined

(Pdb) print locals()
{'.0': <iterator object at 0x10e493b90>, 's1': 'hey, man\nwhats up', 'keywords': ['world', 'he'], 'good_data2': ['hey, man', 'whats up']}
Sandeep
  • 346
  • 5
  • 8

0 Answers0