本文整理汇总了Python中group.Group.section_yl_members方法的典型用法代码示例。如果您正苦于以下问题:Python Group.section_yl_members方法的具体用法?Python Group.section_yl_members怎么用?Python Group.section_yl_members使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.section_yl_members方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: census_yl_list
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import section_yl_members [as 别名]
def census_yl_list(osm, auth, term=None, csv=False,
no_headers=False):
group = Group(osm, auth, MAPPING.keys(), term)
section_map = {'Garrick': 'Beavers',
'Paget': 'Beavers',
'Swinfen': 'Beavers',
'Maclean': 'Cubs',
'Somers': 'Cubs',
'Rowallan': 'Cubs',
'Erasmus': 'Scouts',
'Boswell': 'Scouts',
'Johnson': 'Scouts'}
rows = []
def add_row(section, member):
rows.append([section_map[section], section, member['first_name'], member['last_name'],
member['date_of_birth'],
member['contact_primary_member.address1'],
member['contact_primary_1.address1'],
member['contact_primary_2.address1'],
member['floating.gender'].lower()])
for section in Group.YP_SECTIONS:
yls = group.section_yl_members(section)
for member in yls:
add_row(section, member)
headers = ["Section", "Section Name", "First", "Last", "DOB", "Address1", "Address2", "Address3", "Gender"]
if csv:
w = csv_writer(sys.stdout)
if not no_headers:
w.writerow(list(headers))
w.writerows(rows)
else:
if not no_headers:
print(tabulate.tabulate(rows, headers=headers))
else:
print(tabulate.tabulate(rows, tablefmt="plain"))