Ejemplo n.º 1
0
def main():

    basepath = "/Users/dongjian/groupdata"
    ginfoname = "group_info"
    binpilefile = "/binpile_info.csv"

    linelist = []
    openfilename = basepath + binpilefile
    groupinfo = []
    #g,node,parent,flag=0

    #打开文件,并把文件内容存入列表
    fp = open(openfilename, "r", encoding="utf-8")
    for i in fp.readlines():
        linelist.append(i)

    groupinfo = linelist.pop(0)  #第一行是组信息,建立组
    g, node, parent, flag = groupinfo.strip().split(",")
    grouparry = Binpile(node)  #根据群主建群

    nodelist = []
    for x in linelist:

        g, node, parent, flag = x.strip().split(",")
        #print(node,type(node))
        nodelist.append(node)

    grouparry.bappend(nodelist)
    tmplist = grouparry.show_delta()

    for t in tmplist:
        print(t)
    fp.close()
Ejemplo n.º 2
0
def readgrpmem(cur, grp_id):

    qrysql = "select * from group_member where group_id = %d order by seq" % (
        int(grp_id))

    exeSelect(cur, qrysql)

    memdata = list(cur.fetchall())

    groupinfo = memdata.pop(0)  #第一行是组信息,建立组
    #seq,g,node,parent,left_flag,right_flag=groupinfo
    masternode = str(groupinfo[2])

    grouparry = Binpile(masternode)  #根据群主建群

    nodelist = []
    for record in memdata:

        seq, g, node, parent, left_flag, right_flag = record
        #print(node,type(node))
        nodelist.append(str(node))

    grouparry.bappend(nodelist)

    #tmplist=grouparry.show_delta()
    #
    #for t in tmplist:
    #	print(t)
    return (grouparry)