Guys, Please help me, I can't import Turtle in python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Guys, Please help me, I can't import Turtle in python.

I think Something is wrong. When I import Turtle in python, It does't import.. I used Python 3.7 and I just input import turtle as t. But This sentence came out. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\최민석\AppData\Local\Programs\Python\Python37-32\turtle.py", line 2, in <module> t.shape() AttributeError: module 'turtle' has no attribute 'shape' How to I solve it? please give me a favor.

16th Sep 2018, 7:14 AM
Minseok Choi
4 Answers
+ 7
Simple. The turtle module does not have a "shape" function
16th Sep 2018, 8:16 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
print(dir(turtle)) shows its method, but import it first
16th Sep 2018, 8:16 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
I think you might have forgotten the parentheses when you initialized t as an instance of turtle. You need to write t = turtle(), not t = turtle. Otherwise t will refer to the whole module, which indeed doesn't have a shape attribute. But t as an instance of turtle should have one /Edit: sorry, I didn't read the second sentence. Try: import turtle t = turtle()
16th Sep 2018, 8:30 AM
Anna
Anna - avatar
+ 3
sorry i dont know. i didnt even know you could import turtle into python. sorry
16th Sep 2018, 7:44 AM
Alexander Wood
Alexander Wood - avatar