+ 3

Itertools library

Import takewhile from itertools in Pycharms.But it shows following error NameError: name 'takewhile' is not defined. Any solution??

5th Feb 2019, 4:38 PM
Haider
5 Antworten
+ 5
Haider It should look like this and work both in PyCharm and Sololearn: https://code.sololearn.com/cQQJt6czq4MZ/?ref=app
5th Feb 2019, 4:45 PM
Anna
Anna - avatar
+ 4
Import it like this: "from itertools import takewhile". Then you can use "takewhile" in your code. Don't write "itertools.takewhile"
5th Feb 2019, 4:40 PM
Anna
Anna - avatar
+ 1
Anna thank you.
5th Feb 2019, 5:11 PM
Haider
0
// Zohir I am not using Sololearn Code Playground instead using Pycharm
5th Feb 2019, 4:43 PM
Haider
0
Anna, I import the same way,but the problem persists
5th Feb 2019, 4:45 PM
Haider