- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-random-table.py
More file actions
Latest commit
executable file
·28 lines (21 loc) · 709 Bytes
/
Copy pathexample-random-table.py
File metadata and controls
executable file
·28 lines (21 loc) · 709 Bytes
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
#!/usr/bin/env python
fromtexttableimport*
fromrandomimportrandint
data= []
numcols=randint(2,6)
foriinrange(0, 20-1):
row= {}
forjinrange(0, numcols-1):
buf=''
if( randint(0, 60) ==0):
buf=str(randint( 0, 10000 ))
key='col-'+str(j+1)
row[key] =buf+str(randint(0, 1000))
data.append( row )
headertypes= [ 'keys', 'firstrow', 'none']
headertype=headertypes[randint(0, len( headertypes) -1)]
footertypes= [ 'keys', 'lastrow', 'none']
footertype=footertypes[randint(0, len( footertypes) -1)]
printtexttable.table( data, headertype, footertype )
print"headertype: "+headertype
print"footertype: "+footertype