Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Create-an-HTML-table/Python/create-an-html-table-1.py
Normal file
17
Task/Create-an-HTML-table/Python/create-an-html-table-1.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import random
|
||||
|
||||
def rand9999():
|
||||
return random.randint(1000, 9999)
|
||||
|
||||
def tag(attr='', **kwargs):
|
||||
for tag, txt in kwargs.items():
|
||||
return '<{tag}{attr}>{txt}</{tag}>'.format(**locals())
|
||||
|
||||
if __name__ == '__main__':
|
||||
header = tag(tr=''.join(tag(th=txt) for txt in ',X,Y,Z'.split(','))) + '\n'
|
||||
rows = '\n'.join(tag(tr=tag(' style="font-weight: bold;"', td=i)
|
||||
+ ''.join(tag(td=rand9999())
|
||||
for j in range(3)))
|
||||
for i in range(1, 6))
|
||||
table = tag(table='\n' + header + rows + '\n')
|
||||
print(table)
|
||||
Loading…
Add table
Add a link
Reference in a new issue