एक AttributeError
उठाया जाता है जब मैं पायथन के दस्तावेज़ (here) से उदाहरण कोड का उपयोग करता हूं। उदाहरण के कोड इस प्रकार है:विशेषताएँ बढ़ाता है: __exit__
with os.scandir(path) as it:
for entry in it:
if not entry.name.startswith('.') and entry.is_file():
print(entry.name)
परिणाम एक AttributeError
है:
D:\Programming>test.py
Traceback (most recent call last):
File "D:\Programming\test.py", line 3, in <module>
with os.scandir() as it:
AttributeError: __exit__
हालांकि, एक चर के लिए os.scandir()
बताए ठीक काम करता है। क्या कोई मुझे बता सकता है कि मुझे क्या याद आ रही है?
यही है। मैं अभी भी 3.5.2.3.6 पर काम करता था, धन्यवाद! –