#python #html #jython #jes
Вопрос:
Как я должен написать код, чтобы пользователь мог выбрать цитату из выпадающего меню (затем их выбор появится на веб — сайте для публикации в блоге)?
postTitle = requestString("Title for this post: ")
postDesc = requestString("Description for this post: ")
showInformation("What file would you like to post? ")
postFile= getShortPath(pickAFile())
showInformation("Please pick your favorite quote from the options below: ")
postQuote = ????
def addPost(postTitle, postDesc, postFile, postQuote):
file = open("c:inetpubwwwrootiisstart.htm","a")
file.write("""<p><center><><><><><><><><><><><><><><><><><><><></center></p>""")
file.write("""<p><center>BLOG POST</center></p>""")
file.write("""<p><center>Title: """ postTitle """</center></p>""")
file.write("""<p><center>Description: """ postDesc """</center></p>""")
file.write("""<a href="./reports/""" postFile """">""" postFile """</a>""")
# user picks favorite quote from dropdown menu
file.write("""<p><center><select name="quote" id="quote">
<option value="Hope">"Hope is the thing with feathers that perches in the soul, and sings the tune without the words, and never stops at all. --Emily Dickinson"</option>
<option value="Frost">"Some say the world will end in fire, some say in ice. From what I've tasted of desire I hold with those who favor fire. But if it had to persish twice, I think I know enough of hate to say that for destruction ice is also great and would suffice. --Robert Frost"</option>
</select>
""")
file.close()
addPost(postTitle, postDesc, postFile)
Комментарии:
1. Пожалуйста, отредактируйте вопрос, чтобы ограничить его конкретной проблемой с достаточной детализацией для определения адекватного ответа.