In [7]:
def players2list(players, sort=True):
players = players.split('\n')
player_list = []
for player in players:
player = player.strip().title().split(' ')
lastname = player[-1]
firstname = ' '.join(player[:-1])
name = '{0}, {1}'.format(lastname.upper(), firstname)
player_list.append(name)
if sort:
player_list.sort()
return player_list
In [2]:
def group_players(player_list, num):
group = {}
for n in range(1, num+1):
group[n] = []
for i in range(len(player_list)):
if (i + 1) % num == 0:
group[num].append(player_list[i])
else:
group[(i+1)%num].append(player_list[i])
return group
In [3]:
def print_group(groups):
for gid, players in groups.iteritems():
print gid
for player in players:
print player
In [4]:
def players2list_nosort(players):
players = players.split('\n')
player_list = []
for player in players:
player = player.strip().title().split(' ')
lastname = player[-1]
firstname = ' '.join(player[:-1])
name = '{0} {1}'.format(lastname.upper(), firstname)
player_list.append(name)
return player_list
In [5]:
def merge_double(players1, players2):
player1_list = players2list_nosort(players1)
player2_list = players2list_nosort(players2)
players = zip(player1_list, player2_list)
player_list = ['{0} & {1}'.format(i[0], i[1]) for i in players]
player_list.sort()
return player_list
In [1]:
def make_emails(email_string):
emails = [i.lower().strip() for i in email_string.split('\n')]
for i in set(emails):
print i
In [37]:
p_players = '''Samuel Yu
Linda Li Huang
Olivia Li Huang
JUNTO QIU
Samuel Harris
John Hu
Antonio Li
Willie Hong'''
p_players_noseed = '''Samuel Yu
Olivia Li Huang
JUNTO QIU
Samuel Harris
Antonio Li
Willie Hong'''
p_seeds = '''Linda Li Huang
John Hu'''
In [10]:
players_noseed_list = players2list(players_noseed)
seeds_list = players2list(seeds)
players_group = group_players(players_noseed_list, 2)
seeds_group = group_players(seeds_list, 2)
print_group(players_group)
print '\n'
print_group(seeds_group)
In [38]:
p_list = players2list(p_players)
p_group = group_players(p_list, 2)
print_group(p_group)
In [14]:
# Emails
emails = '''yuj@stgeorge.com.au
lilizhang@bigpond.com
lilizhang@bigpond.com
juntoqiu@hotmail.com
lisa.sydney22@gmail.com
daboau@yahoo.com
li.antonio2003@gmail.com
williehongrsi@hotmail.com
yuj@stgeorge.com.au
lilizhang@bigpond.com
lilizhang@bigpond.com
artsimcollection@yahoo.com.au
Lisa.sydney22@gmail.com
gongli54@gmail.com
yuj@stgeorge.com.au
lilizhang@bigpond.com
lilizhang@bigpond.com
asimlu1@hotmail.com
lisa.sydney22@gmail.com
daboau@yahoo.com
gongli54@gmail.com
williehongrsi@hotmail.com'''
make_emails(emails)
In [21]:
s_players_a = '''Robert Wang
XUEMIN LI
Yibo Zhou
Zhihong Gui
Yan Yang
chongbai liang
YU LIU
zengling zhang
Weiping Huang
Gong li
Yaping He
GUOWU SONG
Ni Qiuming
ping yan li'''
s_players_b = '''David Zheng
LI JIAN GUO
xxx yyy
George Huang
Lewis Lu
kui zhang
YI LU
Pierre ki yin Mak
Zhiwei Cen
David fei
Zheng Hong Chen
JIN ZHAO HE
zhaoqing Zhou
Ping liu'''
In [22]:
s_player_list = merge_double(s_players_a, s_players_b)
s_group = group_players(s_player_list, 3)
print_group(s_group)
In [17]:
j_players='''Patrick Xu
Will Zhao
Sydney Xu
KAICHENG QIU
Michael Li
Minxi Li
raymond jiang
Elwin Song
Susannah Su
Aaron Tian
JUNHONG QIU
Chase Zhao
Harrison Liu
Justin Zhao'''
In [18]:
j_list = players2list(j_players, False)
j_group = group_players(j_list, 3)
print_group(j_group)
In [8]:
j_list = players2list(j_players)
j_group = group_players(j_list, 3)
print_group(j_group)
In [12]:
j_player1 = '''Patrick Xu
Will Zhao
Sydney Xu
KAICHENG QIU
Michael Li
Minxi Li
raymond jiang
Elwin Song
Susannah Su
Aaron Tian
Chase Zhao
JUNHONG QIU
Harrison Liu
Justin Zhao'''
j_list1 = players2list(j_player1, False)
j_group1 = group_players(j_list1, 3)
print_group(j_group1)
In [41]:
bs_players = '''Jason Ju
Fu Jia
Mingfei Jiang
Ran Li
Scross Dounan Shao
Robert Wang
Wai Lam Poon
Yuanxin Liang
Alfred Wei
yuanwei jiang
LI YI XU
Shiliang Zhao
Zhihong Yang
WEICHUN TANG
Changhao Yu
Qinghua Yin
Hansheng Chen
Liqun Niu
Qun Zhuo
HONG ZU WANG
Ka Ming (Eric) On
Yan Yang
Guanhong Rong
Zhenxin Wang
Congbinh Tran
xiapeng huangfu
Wei Fu
Jun lin
Michael Wang
WANGZHE XIA
zengling zhang
Patrick Zhang
Jiyang Zheng
Zhiqiang Qiao
Alan (Vinh) Chung
Zhihong Gui '''
In [43]:
bs_list = players2list(bs_players)
bs_group = group_players(bs_list, 8)
print_group(bs_group)
In [51]:
bd_players1 = '''Han Li
fu Jia
Wai Lam Poon
Mingfei Jiang
WEICHUN TANG
KENG CAO
Jason Weihua Zhu
Qinghua Yin
Hong Zu Wang
Charlie Wang
Ming Zhu
Yuanxin Liang
Howard Cai
Ka Ming (Eric) On
Juncong Zhao
XINHUI CHENG
Zhimin Ling
Peizhong Chen
Jun lin
Honghao Li
JUN SU
Yuan Tian
Ran Li
William Chan'''
bd_players2 = '''Jason Ju
murphy zhang
Scross Dounan Shao
Guo Shao Bo
Minh Pham
JIAQI ZHANG
Zhihong Yang
Yuanwei Jiang
CHIEN-CHEN LIN
Christopher Cheung
Alfred Wei
Zhenxin Wang
Alex Cai
Congbinh Tran
Liqun Niu
kYLE CHENG
Leo Liang
Gary Chen
Robin xu
Zhuo John Ma
TAO SUN
Wenhua Pang
Maxime
Boun Lui'''
In [52]:
bd_player_list = merge_double(bd_players1, bd_players2)
bd_group = group_players(bd_player_list, 6)
print_group(bd_group)
In [24]:
w_players1 = '''Sophie Wang
April Pan
Chuyun Yu
Yingxin Lin
Lin Xue
Grace Chen
Cindy Cheong
WEIHUA GAO'''
w_players2 = '''Jiang Jiang
You hen Li
Lydia Yin
Ziqian Yin
Crystal Ma
Erin Liu
Yasuko Brundrit
Maria Xu'''
In [25]:
w_double = merge_double(w_players1, w_players2)
w_double
Out[25]:
In [26]:
w_double_groups = group_players(w_double, 2)
w_double_groups
Out[26]:
In [28]:
print_group(w_double_groups)
In [59]:
wt_players1 = '''Sophie Wang
April Pan
Chuyun Yu
Yingxin Lin
Crystal Ma
Grace Chen
Cindy Cheong
WEIHUA GAO'''
wt_players2 = '''Jiang Jiang
You hen Li
Lydia Yin
Ziqian Yin
Lin Xue
Erin Liu
Yasuko Brundrit
Maria Xu'''
wt_double = merge_double(wt_players1, wt_players2)
wt_double_groups = group_players(wt_double, 2)
print_groups(wt_double_groups)
In [27]:
ad_player1 = '''Qilong Lin
ka leung (sam) chan
Aaron cao
Yuchen Chen
Tiecheng li
Patrick Zhang
Xingzhi Gao'''
ad_player2 = '''Rong Wang
stephen kwong
sonny ng
Zhongwei Chen
deyang kong
Frank Zhang
Enpeng Chen'''
ad_seed1 = '''Xiaoyuan Jin
Brendan Xu'''
ad_seed2 = '''Michael Wang
Guanqiao Yin'''
In [28]:
ad_player_list = merge_double(ad_player1, ad_player2)
ad_seed_list = merge_double(ad_seed1, ad_seed2)
ad_group = group_players(ad_player_list, 2)
ads_group = group_players(ad_seed_list, 2)
print_group(ads_group)
print '\n'
print_group(ad_group)
In [35]:
ad_players1 = '''Qilong Lin
ka leung (sam) chan
Aaron cao
Yuchen Chen
Tiecheng li
Patrick Zhang
Xingzhi Gao
Xiaoyuan Jin
Brendan Xu'''
ad_players2 = '''Rong Wang
stephen kwong
sonny ng
Zhongwei Chen
deyang kong
Frank Zhang
Enpeng Chen
Michael Wang
Guanqiao Yin'''
In [36]:
ad_players_list = merge_double(ad_players1, ad_players2)
ad_groups = group_players(ad_players_list, 2)
print_group(ad_groups)
In [29]:
as_player = '''Xiaoyuan Jin
Charlie Wang
Jacky Leung
Wei Han
Chien-Chen Lin
Alex Cai
Howard Cai
DA XU
Robert Wong
Tao Sun
lei cao
YONGFENG Lu
Richard Gong
Frank Zhang
ZHENYANG ZHONG
Guan Qiao Yin
Brendan Xu
Yuchen Chen
Enpeng Chen'''
In [30]:
as_list = players2list(as_player)
as_group = group_players(as_list, 4)
print_group(as_group)
In [ ]:
In [30]:
pp = '''Han Li
fu Jia
Wai Lam Poon
Mingfei Jiang
WEICHUN TANG
KENG CAO
Jason Weihua Zhu
Qinghua Yin
Hong Zu Wang
Charlie Wang
Ming Zhu
Yuanxin Liang
Howard Cai
Ka Ming On
Juncong Zhao
XINHUI CHENG
Zhimin Ling
Peizhong Chen
Jun lin
Honghao Li
JUN SU
Yuan Tian
Ran Li
William Chan'''
In [31]:
for i in players2list(pp, False):
print i
In [2]:
single_b_emails = '''orange_ju@hotmail.com
jiafu@derucci.com
donyjiang128@gmail.com
ran.ki@mq.edu.au
Sdshao@hotmail.com
rwnz@hotmail.com
stevekai@hotmail.com
chnjack@gmail.com
alf_wei@hotmail.com
willjyw@hotmail.com
junnyxu@my.com
aubeaches@gmail.com
stevenyang_1992@hotmail.com
FRANZY.TANG@GMAIL.COM
yu.kingsley@yahoo.com
qinghua_yin@yahoo.com.au
Hansheng.chen@sydney.edu.au
nnllqq123@hotmail.com
zhuoqunn@gmail.com
mikewang_68@hotmail.com
eric2014on@gmail.com
richard@realtyprofessional.com.au
ghrong@gmail.com
zhenxin.wang@gmail.com
congbinh2504@gmail.com
huangfuxiapeng@gmail.com
jerrydotfu@gmail.com
linjun68@gmail.com
rhino2i@icloud.com
xiawangzhe@gmail.com
jameszhang666@hotmail.com
patrick@flpinsurance.com.au
zjy1985747815@gmail.com
qiaowenbin25999@gmail.com
henghua@hotmail.com.au
kwai01@163.com
donyjiang128@gmail.com
ran.li@mq.edu.au
Sdshao@hotmail.com
rwnz@hotmail.com
stevekai@hotmail.com
chnjack@gmail.com
alf_wei@hotmail.com
willjyw@hotmail.com
junnyxu@my.com
aubeaches@gmail.com
stevenyang_1992@hotmail.com
FRANZY.TANG@GMAIL.COM
yu.kingsley@yahoo.com
qinghua_yin@yahoo.com.au
hansheng.chen@sydney.edu.au
nnllqq123@hotmail.com
zhuoqunn@gmail.com
mikewang_68@hotmail.com
eric2014on@gmail.com
richard@realtyprofessional.com.au
ghrong@gmail.com
zhenxin.wang@gmail.com
congbinh2504@gmail.com
huangfuxiapeng@gmail.com
jerrydotfu@gmail.com
linjun68@gmail.com
rhino2i@icloud.com
xiawangzhe@gmail.com
jameszhang666@hotmail.com
lauren@insurance.com.au
zjy1985747815@gmail.com
qiaowenbin25999@gmail.com
henghua@hotmail.com.au
kwai01@163.com'''
In [3]:
make_emails(single_b_emails)
In [6]:
a_single_email = '''xiaoyuanjin626@hotmail.com
rwnz@hotmail.com
koala.147@hotmail.com
waynehan96@gmail.com
linpaul5@hotmail.com
hcai2002@yahoo.com.au
hcai2002@yahoo.com.au
heisxuda@qq.com
rawong@whiteglo.com
taosunst@gmail.com
cl9184@hotmail.com
tm2237@gmail.com
richardygong@gmail.com
flptrade@bigond.com
460144267@qq.com
joannastanmore@hotmail.com
daboau@yahoo.com
chenyuchen88@hotmail.co.uk
brannchen.cep@gmail.com
xiaoyuanjin626@hotmail.com
rwnz@hotmail.com
koala.147@hotmail.com
waynehan96@gmail.com
linpaul5@hotmail.com
hcai2002@yahoo.com.au
hcai2002@yahoo.com.au
heisxuda@qq.com
rawong@whiteglo.com
taosunst@gmail.com
cl9184@hotmail.com
tm2237@gmail.com
richardygong@gmail.com
flptrade@bigpond.com
460144267@qq.com
joannastanmore@hotmail.com
daboau@yahoo.com
chenyuchen88@hotmail.co.uk
brannchen.cep@gmail.com'''
In [7]:
make_emails(a_single_email)
In [8]:
adoubleemail = '''357735230@qq.com
xiaoyuanjin626@hotmail.com
srssam@hoymail.com
cl9184@hotmail.com
chenyuchen88@hotmail.co.uk
daboau@yahoo.com
li.jason71@gmail.com
flptrade@bigpond.com
rgao923@hotmail.com
357735230@qq.com
xiaoyuanjin626@hotmail.com
Skyseeto@yahoo.com
sonnywu@gmail.com
timdanaust@hotmail.com
daboau@yahoo.com
atlantissyd@gmailc.om
flptrade@bigpond.com
brannchen.cep@gmail.com
357735230@qq.com
xiaoyuanjin626@hotmail.com
srssam@hotmail.com
cl9184@hotmail.com
chenyuchen88@hotmail.co.uk
daboau@yahoo.com
li.jason71@gmail.com
flptrade@bigpond.com
rgao923@hotmail.com'''
In [9]:
make_emails(adoubleemail)
In [10]:
bdoubleemail = '''civetlai@gmail.com
jiafu@derucci.com0
stevekai@hotmail.com
donyjiang128@gmail.com
FRANZY.TANG@GMAIL.COM
kengcao@hotmail.com
jasonwzhu@gmail.com
qinghua_yin@yahoo.com.au
mikewang_68@hotmail.com
rwnz@hotmail.com
zhum@y7mail.com
chnjack@gmsil.com
hcai2002@yahoo.com.au
eric2014on@gmail.com
821230382@qq.com
thomascheng2112@hotmail.com
jlingau@yahoo.com
pzchen@hotmail.com
linjun68@gmail.com
467261334@qq.com
DERIC-SU@HOTMAIL.COM
ewantian@msn.com
ran.li@mq.edu.au
williamc@amyson.com.au
orange_ju@hotmail.com
murphyzz06@hotmail.com
Sdshao@hotmail.com
316396469@qq.com
m_pham33@hotmail.com
kengcao@hotmail.com
stevenyang_1992@hotmail.com
willjyw@hotmail.com
linpaul5@hotmail.com
rwnz@hotmail.com
alf_wei@hotmail.com
chnjaco@gmail.com
alexcai.281@gmail.com
congbinh2504@gmail.com
nnllqq123@hotmail.com
kylecheng009@hotmail.com
liangzhao@live.com
pzchen@hotmail.com
robin.xu.qd@gmail.com
john521116@hotmail.com
taosunst@gmail.com
vin618@hotmail.com
ran.li@mq.edu.au
wailliamc@amyson.com.au
jiafu@derucci.com
stevekai@hotmail.com
donyjiang128@gmail.com
franzy.tang@gmail.com
kengcao@hotmail.com
jasonwzhu@gmail.com
qinghua_yin@yahoo.com.au
mikewang_68@hotmail.com
rwnz@hotmail.com
zhum@y7mail.com
chnjack@gmail.com
hcai2002@yahoo.com.au
eric2014on@gmail.com
821230382@qq.com
thomascheng2112@hotmail.com
jlingau@yahoo.com
pzchen@hotmail.com
linjun68@gmail.com
467261334@qq.com
deric-su@homtail.com
ewantian@msn.com
ran.li@mq.edu.au
williamc@amyson.com.au'''
In [11]:
make_emails(bdoubleemail)
In [12]:
wdoubleemail = '''rwnz@hotmail.com
aprilpoon@yahoo.com
cindyyu1999@hotmail.com
yingxinlindsay@gmail.com
linxue@gmail.com
gracenz@gmail.com
cheongcindy@hotmail.com
422782880@qq.com
willhyw@hotmail.com
362317077@qq.com
lyin@pymblelc.nsw.edu.au
ziqian0814@gmail.com
linxue@gmail.com
erinliuxin@yahoo.com.au
y.brundrit@live.com.au
422782880@qq.com
rwnz@hotmail.com
aprilpoon@yahoo.com
yu.kingsley@yahoo.com
yingxinlindsay@gmail.com
linxue@gmail.com
gracenz@gmail.com
cheongcindy@hotmail.com
422782880@qq.com'''
In [13]:
make_emails(wdoubleemail)
In [14]:
sdoubleemail = '''rwnz@hotmail.com
xueminli@live.com.au
buscars@hotmail.com
Kwai01@163.com
richard@realtyprofessional.com.au
cbliang8@gmail.com
richard@gmcomputers.net
jameszhang666@hotmail.com
gzwping@hotmail.com
gongli54@gmail.com
yapinghe270@gmail.com
ssggww2014@gmail.com
nqming@optusnet.com.au
pingyanli@gmail.com
rwnz@hotmail.com
lele6611@hotmail.com
buscars@hotmail.com
yyhaust@163.com
richard@realtyprofessional.com.au
kuizhang708@hotmail.com
syukongdi@yahoo.com
jameszhang666@hotmail.com
zhiwcen@yahoo.com.au
davidfei58@gmail.com
henry.zhchen@gmail.com
hohohod2@gmail.com
joe.zhou.8@hotmail.com
meiyagao61@gmail.com
rwnz@hotmail.com
xueminli@live.com.au
buscars@hotmail.com
Kwai01@163.com
richard@realtyprofessional.com.au
cbliang8@gmail.com
richard@gmcomputers.net
jameszhang666@hotmail.com
gzwping@hotmail.com
gongli54@gmail.com
yapinghe270@gmail.com
ssggww2014@gmail.com
nqming@optusnet.com.au
pingyanli@gmail.com.au'''
In [15]:
make_emails(sdoubleemail)
In [16]:
psingleemail = '''yuj@stgeorge.com.au
lilizhang@bigpond.com
lilizhang@bigpond.com
juntoqiu@hotmail.com
lisa.sydney22@gmail.com
daboau@yahoo.com
li.antonio2003@gmail.com
williehongrsi@hotmail.com
yuj@stgeorge.com.au
lilizhang@bigpond.com
lilizhang@bigpond.com
asimlu1@hotmail.com
lisa.sydney22@gmail.com
daboau@yahoo.com
gongli54@gmail.com
williehongrsi@hotmail.com'''
In [17]:
make_emails(psingleemail)
In [18]:
jsingleemail = '''daboau@yahoo.com
aubeaches@gmail.com
aprilpoon@yahoo.com
asimlu1@hotmail.com
shelley168@live.com.au
kennisliu3@gmail.com
willjyw@hotmail.com
liliyhsong@yahoo.com.au
bookmarksu@hotmail.com
ewantian@msn.com
sheenzhaox@gmail.com
asimlu1@hotmail.com
susan@antonysyndicate.com
aubeaches@gmail.com
daboau@yahoo.com
aubeaches@gmail.com
Aprilpoon@yahoo.com
asimlu1@hotmail.com
Shelley168@live.com.au
kennisliu3@gmail.com
willjyw@hotmail.com
liliyhsong@yahoo.com.au
ewantian@msn.com
asimlu1@hotmail.com
susan@antonysyndicate.com
Aubeaches@gmail.com
daboau@yahoo.com
aubeaches@gmail.com
aprilpoon@yahoo.com
asimlu1@hotmail.com
shelley168@live.com.au
kennisliu3@gmail.com
willjyw@hotmail.com
liliyhsong@yahoo.com.au
bookmarksu@hotmail.com
ewantian@msn.com
asimlu1@hotmail.com
aubeaches@gmail.com'''
In [19]:
make_emails(jsingleemail)
In [ ]: