Created
May 25, 2021 08:21
-
-
Save juanarrivillaga/fa706eea82c5f8565353da6694118508 to your computer and use it in GitHub Desktop.
Convert list comprehension to equivalent for loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_code(msg): | |
f,l,i=[item for item in msg.split('0') if len(item)>0] | |
return {'first_name':f,'last_name':l,'id':i} | |
def parse_code(msg): | |
result = [] | |
for item in msg.split("0"): | |
if len(item) > 0: | |
result.append(item) | |
f,l,i = result | |
return {'first_name':f,'last_name':l,'id':i} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment