Τη Τρίτη, 26 Φεβρουαρίου 2019 - 3:26:29 μ.μ. UTC+2, ο χρήστης 
vergos....@gmail.com έγραψε:
> Can  you help me rewrite this function, which when iam using 'pymysql' 
> conncector works normally, it does not when iam using 'bottle_pymysql'
> 
> def coalesce( data ):
>       newdata = []
>       seen = {}
>       for host, ref, location, useros, browser, visits, hits, downloads, 
> authuser in data:
>               # Here i have to decide how to group the rows together
>               # I want an html row for every unique combination of (host) and 
> that hits should be summed together
>               key = host
>               if key not in seen:
>                       newdata.append( [ [host], [ref], location, useros, 
> browser, [visits], hits, [downloads], authuser ] )
>                       seen[key] = len( newdata ) - 1      # Save index (for 
> 'newdata') of this row
>               else:       # This row is a duplicate row with a different 
> referrer & visit datetime & torrent download
>                       rowindex = seen[key]
>                       newdata[rowindex][0].append( host )
>                       newdata[rowindex][1].append( ref )
>                       newdata[rowindex][5].append( visits )
>                       newdata[rowindex][6] += hits
>                       newdata[rowindex][7].append( downloads )
>       return newdata



For some reason in 'bottle-pymysql'

pagehit = cur.fetchone()[0] does not work

while reffering by name of the field 

pagehit = cur.fetchone()['hits'] does work.

Please help me write the baove function in a similar way.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to