insert python script in current script

Prashant shikha_saxena2007 at yahoo.com
Wed Apr 16 03:42:06 EDT 2008


I was wondering is there any way to do this:

I have written a class in python and __init__ goes like this:

def __init__(self):

self.name = 'jack'
self.age = 50

import data




now here there is data.py in the same directory and contents are like:

self.address = 'your address'
self.status = 'single'

The problem is 'self' is giving some error here. I need to know if
somehow I can do this. It's like inserting the script as it's part of
the file itself.

Cheers




More information about the Python-list mailing list