Every line of 'find all substrings of a string python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
1 def substrings(string): 2 result = [string] 3 for length in range(1, len(string)): 4 start = 0 5 end = start + length 6 while end <= len(string): 7 result.append(string[start:end]) 8 start += 1 9 end += 1 10 return result