os.path.commonprefix()
works well for lists 🙂
>>> x = [[3,2,1], [3,2,1,4,5], [3,2,1,8,9], [3,2,1,5,7,8,9]]
>>> import os
>>> os.path.commonprefix(x)
[3, 2, 1]
More Related Contents:
- How to match a string to pattern “Foo-Bar”, where Bar can be any element of a list? [closed]
- Accessing the index in ‘for’ loops
- Create a dictionary with comprehension
- Find the similarity metric between two strings
- Converting a Pandas GroupBy output from Series to DataFrame
- Find the nth occurrence of substring in a string
- Split a large pandas dataframe
- How to write a multidimensional array to a text file?
- Getting the SQL from a Django QuerySet [duplicate]
- Image segmentation based on edge pixel map [closed]
- How to highlight specific x-value ranges
- selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH with GeckoDriver Selenium Firefox
- How to duplicate virtualenv
- Send Outlook Email Via Python?
- Using Counter() in Python to build histogram?
- How to roll my own pypi?
- Are there any alternatives to py2exe? [closed]
- “__init__” vs “__call__” in python class
- UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 23: ordinal not in range(128)
- How to add header row to a pandas DataFrame
- “RuntimeWarning: coroutine ‘BotBase.load_extension’ was never awaited” after updating discord.py
- Python Pandas – Merge based on substring in string
- Disable global variable lookup in Python
- How to update Pandas from Anaconda and is it possible to use eclipse with this last
- How to preserve line breaks when generating python docs using sphinx
- Would you prefer using del or reassigning to None (garbage collecting)
- Comparing Matlab and Numpy code that uses random number generation
- Connecting to ‘Explicit FTP over TLS’ in Python (??)
- Sort array’s rows by another array in Python
- flask sqlalchemy query with keyword as variable