You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yy_rms_39zhiyao_duizhao/test_demo.py

30 lines
668 B

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/07/14 09:25:19
'''
class BaseDemo:
def t_dic(self, tp):
dic = {
"1": "我是%s, 我今年%s",
"2": "我是%s,我今年%s岁,我家住在%s",
"3": "我是%s,我今年%s岁,我家住在%s, 我家有%s口人",
}
return dic.get(tp)
def pr_info(self, num):
pr = self.t_dic(str(num))
if num == 1:
print(pr % ("小名", "11"))
elif num == 2:
print(pr % ("小名", "11", "河南"))
else:
print(pr % ("小名", "11", "河南", "5"))
a = BaseDemo()
a.pr_info(2)