Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Q: How to read the file? binary and text interspersed</strong></p> <p><em>A: Don't bother, just read it as normal text and you'll be able to keep your binary/text dichotomy (otherwise you won't be able to regex it as easily)</em></p> <pre><code>fh = open('/path/to/my/file.ext', 'r') fh.read() </code></pre> <p>Just in case you want to read binary later for some reason, you just add a b to the second input of the open:</p> <pre><code>fh = open('/path/to/my/file.ext', 'rb') </code></pre> <p><strong>Q: Eliminate unnecessary control characters</strong></p> <p><em>A: Use the python <a href="http://docs.python.org/library/re.html" rel="nofollow">re</a> module. Your next question sorta ask how</em></p> <p><strong>Q: parse the messages in between two \xaa USEFUL TEXT INFORMATION \xaa (HEX 'aa')</strong></p> <p><em>A: re module has a findall function that works as you (mostly) expect.</em></p> <pre><code>import re mytext = '\xaaUseful text that I want to keep\xaa^X^X^X\xaaOther text i like\xaa' usefultext = re.findall('\xaa([a-zA-Z^!-~0-9 ]+)\xaa', mytext) </code></pre> <p><strong>Q: print out the required stuff</strong></p> <p>*A: There's a print function...</p> <pre><code>print usefultext </code></pre> <p><strong>Q: Loop through all the lines.. and more files.</strong></p> <pre><code>fh = open('/some/file.ext','r') for lines in fh.readlines(): #do stuff </code></pre> <p>I'll let you figure out the <a href="http://docs.python.org/library/os.html" rel="nofollow">os</a> module to figure out what files exist/how to iterate through them.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload