Python to create tables

From Norwich Hackspace
Jump to navigation Jump to search
  1. this is a python script to turn text into table for wiki


thing = """ Material Colour Thickness Speed Power Comment Perspex Black 3 20 55 Perspex Clear - 450 12 - 22 Engrave - see sample """

lines = thing.splitlines()



i = 0 output = for line in lines: eachTabs = line.split('\t') output += '|-\n' for each in eachTabs: output+= '| ' + each + ' |' output = output[:-1] output += '\n'

print(output)



"""

Header text Header text Header text Header text Header text Header text
Example Example Example Example Example Example

"""