Problem with importing in Python

su29090 129km09 at gmail.com
Fri Jan 11 23:38:30 CET 2013


On Friday, January 11, 2013 5:27:21 PM UTC-5, Chris Angelico wrote:
> On Sat, Jan 12, 2013 at 9:17 AM, su29090  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

 It worked! Thanks so much! :)



More information about the Python-list mailing list