Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2013
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. $ cat ~/scripts/strip_html.py
  2. #!/usr/bin/python
  3. # coding=utf-8
  4. # -*- encoding: utf-8 -*-
  5.  
  6. import sys, codecs, copy, commands;
  7.  
  8. sys.stdin = codecs.getreader('utf-8')(sys.stdin);
  9. sys.stdout = codecs.getwriter('utf-8')(sys.stdout);
  10. sys.stderr = codecs.getwriter('utf-8')(sys.stderr);
  11.  
  12. c = sys.stdin.read(1);
  13.  
  14. printo = True;
  15.  
  16. while c: #{
  17. if c == '<': #{
  18. printo = False;
  19. c = sys.stdin.read(1);
  20. continue;
  21. elif c == '>': #{
  22. printo = True;
  23. c = sys.stdin.read(1);
  24. continue;
  25. #}
  26. if printo == True: #{
  27. sys.stdout.write(c);
  28. #}
  29. c = sys.stdin.read(1);
  30. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement