
June 17, 2024
7:28 a.m.
The os.path.commonprefix function basically returns the common initial characters (if any) shared by a sequence of strings, e.g. os.path.commonprefix(("Python is great!", "Python is not bad", "Python helps")) # returns "Python " The following was wrong. os.path.commonprefix uses min and max, not sort. I withdraw it: I also suspect that this function could be made more efficient. It sorts the sequence. While sorting is very fast (thanks, Uncle Tim!) it seems a bit OTT in this case. Thoughts? Best wishes Rob Cliffe
252
Age (days ago)
252
Last active (days ago)
0 comments
1 participants
participants (1)
-
Rob Cliffe