Skip to main content
9 events
when toggle format what by license comment
Mar 31, 2023 at 15:06 comment added bfontaine "This assumes both lists contain strings with equivalent beginnings". If you assume this, all you need to do is truncate the longest list with the length of the shortest; you don’t need pathlib or any module.
Aug 24, 2018 at 18:09 history edited pylang CC BY-SA 4.0
Fix output
Aug 24, 2018 at 18:09 comment added pylang Yes, it is a feature of these approaches. As mentioned, these solutions are order preserving - they assume some relative order between the lists. An unordered solution would be to diff two sets.
Aug 24, 2018 at 10:50 comment added KenHBS The itertools solution only works when the elements in temp1 and temp2 line up well. If you, for example, turn around the elements in temp2 or insert some other value in the beginning of temp2, the listcomp will just return the same elements as in temp1
Jul 21, 2018 at 0:30 history edited pylang CC BY-SA 4.0
Add simple example
May 10, 2018 at 2:10 history edited pylang CC BY-SA 4.0
added 38 characters in body
May 10, 2018 at 2:05 history edited pylang CC BY-SA 4.0
added 38 characters in body
May 10, 2018 at 1:52 history edited pylang CC BY-SA 4.0
added 18 characters in body
May 10, 2018 at 1:35 history answered pylang CC BY-SA 4.0