homeplynamelist = ["Hugo Lloris (G)(C)","Patrice Evra","Adil Rami","N'Golo Kante","Antoine Griezmann","Dimitri Payet","Olivier Giroud", "Blaise Matuidi","Paul Pogba","Bacary Sagna","Laurent Koscielny","Christophe Jallet","Yohan Cabaye","Andre-Pierre Gignac", "Anthony Martial","Morgan Schneiderlin","Eliaquim Mangala","Steve Mandanda (G)","Lucas Digne","Moussa Sissoko","Kingsley Coman", "Samuel Umtiti","Benoit Costil (G)"] homeplyjernolist = [1,3,4,5,7,8,9,14,15,19,21,2,6,10,11,12,13,16,17,18,20,22,23] homeplynamelistshort = [] for hlist in homeplynamelist: hlist = hlist.split('(')[0] listdata = hlist.split(' ')[0][:1] newdata = listdata+'. '+hlist.split(' ')[1] homeplynamelistshort.append(newdata) print(homeplynamelistshort)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question