Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foo
- bar
- mylist = [
- 'hello',
- 'world'
- ]
- def _gen():
- for x in mylist:
- with open('/tmp/list') as fh:
- yield('-'.join([x, next(fh)]))
- for i in _gen():
- print(i)
- hello-foo
- world-foo
- hello-foo
- hello-bar
- world-foo
- world-bar
- for x in mylist:
- with open('/tmp/list') as fh:
- for line in fh:
- yield '-'.join([x, line.strip()])
Add Comment
Please, Sign In to add comment