您的位置:首页 > 编程语言 > Python开发

#python#自己写的一段小代码

2014-08-11 17:45 337 查看
代码:

__author__ = 'Administrator'
DEFAULT_TENANT_ID = 1234
DEFAULT_ROLE_ID = 1234
TENANT_ID = int(input("Please enter the tenant ID:"))
ROLE_ID = int(input("Please input your Role ID:"))
STATUS = {'E':'Error :(','A':'Active :)'}
RESULT = ''
RESULT2 = ''
if TENANT_ID == DEFAULT_TENANT_ID:
RESULT2 = STATUS['A']
if ROLE_ID == DEFAULT_ROLE_ID:
RESULT = STATUS['A']
else:
RESULT2 = STATUS['E']
RESULT = STATUS['E']
print "-"*18
print ("|"+" %-4i "+"|"+" %-9s "+"|") % (TENANT_ID,RESULT2)
print ("|"+" %-4i "+"|"+" %-9s "+"|") % (ROLE_ID,RESULT)
print "-"*18





前者为正确(不完全正确)代码,后者为错误代码。

以后要多多留意字典和print相关的问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python