Hello,
Is there a better way to write this piece of code? I'm looking for unique entries to append into a list.
Thanks in advance.
Is there a better way to write this piece of code? I'm looking for unique entries to append into a list.
1 2 3 4 |
l = [] if mgr.get_obj_id(i).split( '.' )[: - 1 ] not in l: l.append(mgr.get_obj_id(i).split( '.' )[: - 1 ]) |
Larz60+ write Nov-22-2020, 10:45 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed this time. Please use code tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed this time. Please use code tags on future posts.