@@ -0,0 +1,2599 @@
+import csv%0Aimport time%0A%0A%0Adef main():%0A    timetorest = 0  # no rest for the wicked%0A    timestart = time.time()%0A    print(time.strftime('%5B%25d/%25m %25H:%25M:%25S%5D', time.localtime()) + ' Starting')%0A    contactsReader = csv.reader(open(r'contacts.csv'), delimiter=';')%0A    resultFile = open(r%22output.csv%22, 'wb')%0A    global wr, rowrow, rowrowrow, rownorow%0A    wr = csv.writer(resultFile, dialect='excel')%0A    rowrow = %5B%5D%0A    rowrowrow = %5B%5D%0A    rownorow = %5B%5D%0A    countone = 0%0A    for row in contactsReader:%0A        countone = countone + 1%0A        rowrow.append(row)%0A    rowrow.pop(0)%0A    countone = countone - 1%0A    print(%0A        time.strftime(%0A            '%5B%25d/%25m %25H:%25M:%25S%5D',%0A            time.localtime()) +%0A        ' Contact list extracted.%5Cn%5CnExpanding...')%0A    if countone %3E 500:%0A        timetorest = 0.05%0A    if countone %3E 1000:%0A        timetorest = 0%0A    time.sleep(timetorest)%0A    for row in rowrow:%0A        rowrowrow.append(row%5B0:2%5D)%0A    print(%0A        time.strftime(%0A            '%5B%25d/%25m %25H:%25M:%25S%5D',%0A            time.localtime()) +%0A        ' There are ' +%0A        str(countone) +%0A        ' records to expand, it may take some time.')%0A    time.sleep(timetorest)%0A    #print(time.strftime('%5B%25d/%25m %25H:%25M:%25S%5D',time.localtime()))%0A    for row in rowrowrow:%0A        for rowtwo in rowrow:%0A            rownorow.append(row + rowtwo)%0A            if rownorow%5B-1%5D%5B0%5D == rownorow%5B-1%5D%5B2%5D:%0A                rownorow.pop()%0A    #print(time.strftime('%5B%25d/%25m %25H:%25M:%25S%5D',time.localtime()))%0A    print(time.strftime('%5B%25d/%25m %25H:%25M:%25S%5D', time.localtime()) +%0A          ' Expanded to memory ok. Now writing to output.csv ' +%0A          str((countone *%0A               countone) -%0A              countone) +%0A          ' records...')%0A    time.sleep(timetorest * 2)%0A    # counttwo=0%0A    # for row in rownorow:%0A    # if counttwo/countone==counttwo%25countone:%0A    # print('.'),%0A    # time.sleep(timetorest/100)%0A    wr.writerows(rownorow)%0A    #counttwo= counttwo+1%0A    print(time.strftime('%5B%25d/%25m %25H:%25M:%25S%5D', time.localtime()) +%0A          ' Done expanding ' +%0A          str(countone) +%0A          ' records into ' +%0A          str((countone *%0A               countone) -%0A              countone) +%0A          ' records in ' +%0A          str(format(time.time() -%0A                     timestart -%0A                     (timetorest *%0A                      2) -%0A                     (timetorest /%0A                      100) *%0A                     ((((countone *%0A                         countone) -%0A                        countone)) /%0A                      countone), '.4f') +%0A              ' seconds'))%0A%0Aif __name__ == '__main__':%0A    main()%0A    # EOF%0A

create a minor adaptation