Hello everyone.
I'm new to python. I have already tried to make some smal programs as excercise and that works fine for me but now i wanted to make something useful for me.
I have different excel files (list with, names, forname, adress, phone number...). Each excel file has its own list.
Now i want to make a program that can:
This is what i have for now:
Please any help is welcome! ! !
I'm new to python. I have already tried to make some smal programs as excercise and that works fine for me but now i wanted to make something useful for me.
I have different excel files (list with, names, forname, adress, phone number...). Each excel file has its own list.
Now i want to make a program that can:
- make one fictive person out of the different excel files (i think mine works!)
- write this to a new excel file
- Asking the user to give how many fictive persons he wants to make and write them all to one excel file.
This is what i have for now:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import xlrd import random import xlsxwriter #==> This I did for every workbook. workbook = xlrd.open_workbook( "achternamen.xlsx" ) worksheet = workbook.sheet_by_index( 0 ) total_rows = worksheet.nrows total_cols = worksheet.ncols tableAchternamen = list () recordAchternamen = list () for x in range (total_rows): for y in range (total_cols): recordAchternamen.append(worksheet.cell(x,y).value) tableAchternamen.append(recordAchternamen) recordAchternamen = [] x + = 1 #==> This give me a result printed on Python SlachtofferAchternaam = print (random.choice(tableAchternamen)) SlachtofferVoornamen = print (random.choice(tableVoornamen)) SlachtofferTelefoonnummer = print (random.choice(tableTelefoonnummers)) SlachtofferAdressen = print (random.choice(tableAdressen)) resultaat = ( [ 'Achternaam' , SlachtofferAchternaam], [ 'Voornaam' , SlachtofferVoornamen], [ 'Telefoonnummer' , SlachtofferTelefoonnummer], [ 'Adres' ,SlachtofferAdressen], ) #Start van de cellen die gebruikt worden row = 0 col = 0 for item, cost in (resultaat): worksheet.write(row, col, item) worksheet.write(row, col + 1 , cost) row + = 1 workbook.close() |