标签:imp def odi 访问 python mode print style pre
login.py
#!/usr/bin/dev python
# coding:utf-8
def index():
print u‘欢迎访问xx网站首页‘
def login():
print u‘登录成功‘
def logout():
print u‘退出登录‘
class Person(object):#新式类
def __init__(self):
pass
def info(self):
print u‘我是Person类的info的方法‘
url = raw_input(u‘请输入路由地址:\n‘)
target_models,target_function = url.split(‘/‘)
m =__import__(target_models)
if hasattr(m,target_function):
target_function = getattr(m,target_function)
target_function()
else:
print ‘Not Found 404 Page‘
login/login
login/logout
标签:imp def odi 访问 python mode print style pre
原文地址:https://www.cnblogs.com/hyzhang/p/10728774.html