title: Grouping a string using regex
body: <p>I want to convert string l1 into a list of dictionaries like shown in the example_dict.</p>
  <pre><code>example_dict = {&quot;host&quot;:&quot;146.204.224.152&quot;, 
                  &quot;user_name&quot;:&quot;feest6811&quot;, 
                  &quot;time&quot;:&quot;21/Jun/2019:15:45:24 -0700&quot;,
                  &quot;request&quot;:&quot;POST /incentivize HTTP/1.1&quot;}
  </code></pre>
  <p>But the code is returning no value, can you help?</p>
  <pre><code>  import re
  
     l1=&quot;146.204.224.152 - feest6811 [21/Jun/2019:15:45:24 -0700] &quot;POST 
     /incentivize HTTP/1.1&quot; 302 4622\n197.109.77.178 - kertzmann3129 
     [21/Jun/2019:15:45:25 -0700] &quot;DELETE/virtual/solutions/target/web+services 
     HTTP/2.0&quot; 203 26554\n&quot;
   
      def logs():
      with open(&quot;logdata.txt&quot;, &quot;r&quot;) as file:
          logdata = file.read()
   
          pattern= r'(?P&lt;host&gt;(?:\d+\.){3}\d+) - (?P&lt;user_name&gt;[\w-]+) \[(? 
          P&lt;time&gt;[^\]]+)\] &quot;(? 
         P&lt;request&gt;[^&quot;]+)&quot;'
          logs1=[]
      for item in re.finditer(pattern,logdata,re.VERBOSE):
              print(item.groupdict())
              logs1.append(item) 
      return(logs1) 
     len(logs())'''
  </code></pre>