简体   繁体   中英

How can i identify a turtle from a list by its position in Python?

I'm coding a race of multiple turtles, and I would like to access my list of turtles and atm when I print the winner I get " turtle.Turtle object at 0x05D8A770". I would like to get the actual colour of the winning turtle from my list.

Thank you, Suz

You can use:

print(winningturtle.pencolor())

or:

print(winningturtle.fillcolor())

depending on which one you want. For more info on turtle, see here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM