How to start a Python script several functions in

Posted by chrissygormley on Stack Overflow See other posts from Stack Overflow or by chrissygormley
Published on 2010-05-18T09:17:32Z Indexed on 2010/05/18 9:20 UTC
Read the original article Hit count: 252

Filed under:
|
|

Hello,

I have a Python script and I want to call it several functions down the script. Example code below:

class Name():

    def __init__(self):
        self.name = 'John'
        self.address = 'Place'
        self.age = '100'

    def printName(self):
        print self.name

    def printAddress(self):
        print self.address

    def printAge(self):
        print self.age

if __name__ == '__main__': 
    Person = Name()
    Person.printName()
    Person.printAddress()
    Person.printage()

I execute this code by entering ./name.py. How could I exectute this code from the function printAddress() down the the end of the script?

Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about execute