Problem with importing in Python

Chris Angelico rosuav at gmail.com
Fri Jan 11 17:27:21 EST 2013


On Sat, Jan 12, 2013 at 9:17 AM, su29090 <129km09 at gmail.com> wrote:
> Circle.py
>
> class circle:
>
> from Circle import Circle

Inside the Circle module is a class named circle. You can't import
Circle from that.

But Python isn't Java. You don't have to put each class into its own
file. Just put class circle (or class Circle to follow Python naming
convention) into the other file, whose name you haven't given.

If they're already in the same file, then just drop the import. Easy!

By the way:
>    main() # Call the main function
You'll need to put that flush left. At the moment, that call is part
of the definition of main().

Hope that helps!

ChrisA



More information about the Python-list mailing list