About 4,550,000 results
Open links in new tab
  1. Python's most efficient way to choose longest string in list?

    I have a list of variable length and am trying to find a way to test if the list item currently being evaluated is the longest string contained in the list. And I am using Python 2.6.1 For example:

  2. How to find the longest common substring between two strings …

    I want to write a Python code that computes the longest common substring between two strings from the input. Example: word1 = input ('Give 1. word: xlaqseabcitt') word2 = input ('Give 2. word:

  3. how to find the longest word in python? - Stack Overflow

    Sep 29, 2015 · Use max python built-in function, using as key parameter the len function. It would iterate over word_list applying len function and then returning the longest one.

  4. python - Is there a zip-like function that pads to longest length ...

    Mar 19, 2019 · 289 Is there a built-in function that works like zip() but that will pad the results so that the length of the resultant list is the length of the longest input rather than the shortest input?

  5. python - How to find the longest list in a list? - Stack Overflow

    Aug 26, 2018 · The answer from blhsing is great for finding the first, longest sub-list, and it's fast. For a list of 1M lists, varying in length from 1-15, it takes 29.6 ms to return the first list with the …

  6. python - Find common substring between two strings - Stack …

    Sep 10, 2013 · For completeness, difflib in the standard-library provides loads of sequence-comparison utilities. For instance find_longest_match which finds the longest common …

  7. python - Finding the longest words in a text file - Stack Overflow

    May 4, 2013 · I have created a function to find the longest word in a text file and finding the longest word (s) in a text file that can be made from 9 letters. I'm new to python and I'm …

  8. python, printing longest length of string in a list

    Dec 21, 2021 · My question is to write a function which returns the longest string and ignores any non-strings, and if there are no strings in the input list, then it should return None. my answer: …

  9. python - Length of longest word in a list - Stack Overflow

    Feb 1, 2013 · 7 What is the more pythonic way of getting the length of the longest word: len(max(words, key=len)) Or: max(len(w) for w in words) Or.. something else? words is a list of …

  10. Longest Common Subsequence in Python - Stack Overflow

    This one works, because in Python negative indices are used to get the last item of a list and these items are 0 in this case. cs += s1[i] in line 11/14 For example if you found that the …