Python to create tables

From Norwich Hackspace
Revision as of 16:42, 25 September 2020 by Nicholas w (talk | contribs) (Created page with "# 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 En...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

"""