Advertisement
steve-shambles-2109

Python Snippets vol 33. Bonus snippet

Oct 13th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. """
  2. Python Snippets vol 33.
  3. Bonus snippet:
  4. stevepython.wordpress.com
  5.  
  6. Read a file between a range of lines
  7. source: Unknown.
  8. """
  9.  
  10. import itertools
  11.  
  12. with open('test2.txt', 'r') as f:
  13.     for line in itertools.islice(f, 2, 10):
  14.         print(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement