IMO the easiest way to create content with external scripts is to create JSON or CSV files, that can then be imported into TW.
Have a closer look at these posts:
Basically every format described there can be used to import content into a wiki. With python it should be straight forward to create any of the described formats.