简体   繁体   中英

Python: Novice Class object prac and __main__

I've been trying to practice testing my modules by adding

if __name__ == '__main__':

That isn't a function, it's a method. You need to call the method off an object.

p = Prac()
p.Fun()

Read this.

what is the Question? i can't find the Question 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