How to create table dynamically
<p>I want to create table depending on user input value. </p>

<p>There are a max 7 column per table, with first column as name of row. When the user enters 9 values instead of 7, then it should create next table with two column. Then to those table i am giving value later in the prog from some computation.</p>

<p>I tried this code but getting error </p>

<pre><code>vr={}
num=0
    for num in range(1,k):
        print site_count
        print 'num is',num

vr[str(num)]=document.add_table(rows=13, cols=(7))
print vr['1']

for num in range(1,k+1):
    vr['num'].cell(1, 0).text='Subscribed BW'
    vr['num'].cell(2, 0).text='Peak LAN'
    vr['num'].cell(3, 0).text='Peak WAN-IN'
    vr['num'].cell(4, 0).text='Peak WAN-OUT'
    vr['num'].cell(5, 0).text='Recommended BW Capacity'
    vr['num'].cell(7, 0).text='Peak Compression'
    vr['num'].cell(9, 0).text='Optimized Traffic'
    vr['num'].cell(10, 0).text='Optimized Traffic%'
    vr['num'].cell(12, 0).text='Key Applications'
    vr['num'].style ='TableGrid'
</code></pre>

<p><strong>ERROR as:</strong>    vr['num'].cell(1, 0).text='Subscribed BW'
KeyError: 'num'</p>

<p>Is there any other solution </p>