Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ij_nest2split.py
- import itertools
- sentence = "this is just a test"
- words = sentence.split()
- splits = []
- for i in range(0, len(words)):
- for j in range(i + 1, len(words) + 1):
- split = words[i:j]
- splits.append(split)
- for split in splits:
- print(split)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement