Apr-17-2019, 03:38 AM
I am trying to automate making my little homework webpages. I've made lots of little Python programs. For example:
makeRadioButtonsInlineV1.py
it makes sets of Radio buttons in html. It also returns a string of html. Below is the part that makes the html, it calls makeSetRBs():
Trouble is, it starts immediately after 'import makeRBsInlineV1 as fl'. I have no chance to do:
myString = fl
How do I catch the output of fl as a string??
makeRadioButtonsInlineV1.py
it makes sets of Radio buttons in html. It also returns a string of html. Below is the part that makes the html, it calls makeSetRBs():
def makeHTML():
for j in range(0, int(numSets)):
html = []
value = str(j + 1)
line1 = '<p> <b> ' + value + ': </b> <BR>\n'
html.append(line1)
gapNum = int(startNum) + j
namenumber = radioName + str(gapNum)
setRBs = makeSetRBs(value, namenumber)
for k in range(0, len(setRBs)):
html.append(setRBs[k])
html.append('</p>\n')
html.append('\n')
htmlString = '\n'.join(html)
file = open(pathToRBs + filename, 'a')
file.write(htmlString)
file.close()
print('All done, now copy and paste into the webpage!')
return htmlString;I call the python with: Quote:>>> import makeRBsInlineV1 as fl
How many radio buttons in each set of radio buttons?
4
How many sets of radio buttons do you want?
5
What should be the starting number for the RB names? Just a number ike 24?
1
What week number is this? Enter Week1 or similar.
Week100
All done, now copy and paste into the webpage!
All done should have a string now.
>>>
Trouble is, it starts immediately after 'import makeRBsInlineV1 as fl'. I have no chance to do:
myString = fl
How do I catch the output of fl as a string??
