Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Use the cool variable as a two state latch which will be True
- # whenever inside a json block and False outside of it.
- cool = False
- with open('input.log') as fh:
- for line in fh:
- if not cool:
- if line.startswith('{'): # or some other expression triggering
- # the start of a json block
- cool = True
- print line
- else:
- print line # This has json
- if line.startswith('}'): # end of json
- cool = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement