python script


SUBMITTED BY: kukorius

DATE: Jan. 14, 2018, 4:27 p.m.

FORMAT: ANTLR With Python Target

SIZE: 673 Bytes

HITS: 148

  1. [hork@archbang whergbot]$ python2.7
  2. Python 2.7.1 (r271:86832, Feb 21 2011, 01:26:25)
  3. [GCC 4.5.2 20110127 (prerelease)] on linux2
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> with open("quotes.txt") as q:
  6. ... for i, l in enumerate(q):
  7. ... pass
  8. ... derp = i + 1
  9. ... print derp
  10. ...
  11. Traceback (most recent call last):
  12. File "<stdin>", line 4, in <module>
  13. NameError: name 'i' is not defined
  14. ## derp
  15. >>> with open("quotes.txt") as q:
  16. ... for line in q:
  17. ... for i, l in enumerate(line):
  18. ... pass
  19. ... derp = i + 1
  20. ... print derp
  21. ...
  22. >>>

comments powered by Disqus