一気にpython ABC 2

675 ワード

first.py
def show(params):
    return ";".join(["%s=%s" % (k, v) for k, v in params.items()])

class First:
    def show(self,params):
        return "
".join(["%s=%s" % (k, v) for k, v in params.items()])
 
second.py
import first

conn={"language":"python","framework":"Django"};
result = first.show(conn)
print result

myfirst = first.First()
result1=myfirst.show(conn)
print result1

 
framework=Django;language=python framework=Django language=python