Python get common prefix from a list of strings
Get the common prefix from a list of strings using Python.
import os
words = [
'alpha',
'alphabet',
'alphabetical',
'alphanumeric',
]
print(os.path.commonprefix(words))
alpha
Get the common prefix from a list of strings using Python.
import os
words = [
'alpha',
'alphabet',
'alphabetical',
'alphanumeric',
]
print(os.path.commonprefix(words))
alpha
Comments
Leave a Reply