0

is it possible to reduce length of this code

https://code.sololearn.com/c46S144N3EDN/?ref=app

16th Jan 2019, 9:37 AM
Raj Charan
3 Réponses
+ 6
print([s[0].split('@')[0] for s in charan]) or print([s[0][:s[0].index('@')] for s in charan])
16th Jan 2019, 11:05 AM
Anna
Anna - avatar
+ 1
split1=i[0].split("@")[0] or if you want to put each element in an individual list: split1=[i[0].split("@")[0]] This doesn't seem to be exactly what you want, but I'm unsure of what you want your program to print if charan has more elements.
16th Jan 2019, 11:11 AM
Zen
Zen - avatar
0
https://code.sololearn.com/cpwry0uv6u0g/?ref=app made changes like this and working fine. is there a alternative way?
16th Jan 2019, 9:46 AM
Raj Charan