Log file to Pandas Dataframe
<p>I have log files, which have many lines in the form of :</p>

<pre><code>LogLevel    [13/10/2015 00:30:00.650]  [Message Text]
</code></pre>

<p>My goal is to convert each line in the log file into a nice Data frame. I have tired to do that, by splitting the lines on the [ character, however I am still not getting a neat dataframe. </p>

<p>My code:</p>

<pre><code>level = []
time = []
text = []

   with open(filename) as inf:
     for line in inf:
       parts = line.split('[')
         if len(parts) &gt; 1:  
           level = parts[0]
           time = parts[1]
           text = parts[2]
        print (parts[0],parts[1],parts[2])

 s1 = pd.Series({'Level':level, 'Time': time, 'Text':text})
 df = pd.DataFrame(s1).reset_index()
</code></pre>

<p>Heres my printed Data frame:</p>

<pre><code>Info      10/08/16 10:56:09.843]   In Function CCatalinaPrinter::ItemDescription()]

Info      10/08/16 10:56:09.843]   Sending UPC Description Message ]
</code></pre>

<p>How can I improve this to strip the whitespace and the other ']' character</p>

<p>Thank you</p>