我已经根据我在Github上找到的代码创建了一个文本摘要生成器。我正在尝试编写脚本,询问文本标题并询问实际文本。
title = """ """
content = """
As metro Atlanta's weather and road conditions continue to thaw after this week's snowstorm, MARTA is planning modified bus and Mobility (paratransit) service starting tomorrow, initially on 30 "life-line" routes. MARTA's rail service will continue operating on a weekend schedule on all lines.
Bus and Mobility service will start at 7 a.m. Friday and run until 11:30 p.m. (See below for preliminary list of restored bus routes or visit MARTA's website: itsmarta.com.) The first round of bus routes being restored provide transit access to some of the region's major hospitals, job centers and commercial corridors. Customers may experience extended waits on some routes are asked to please allow extra time to complete their trips. Based on specific road and traffic conditions, more routes may be added throughout the day and real-time adjustments to the bus schedule are possible.
MARTA rail service will begin for customers at 4:35 a.m. Friday and run until about 2 a.m. on Saturday. Customers should mostly expect wait times for trains ranging from 10 to 20 minutes – conditions permitting. Since some rail stations are open to the elements, customers are advised to dress accordingly.
"""
^这就是我在代码中所拥有的:在Title中,您输入标题。 content是用户想要汇总的文本。
如果您想要演示:您可以转到http://runnable.com/Uv1foJAZ0BxuAABl/summerizer-for-python并点击“运行”。
我如何让节目询问标题和内容?
答案 0 :(得分:2)
在python 2.x中,你可以这样做:
usertext = raw_input("message here")
for python 3.x:
usertext = input("message here")
答案 1 :(得分:0)
您是否想要一种方法来获取用户对标题和内容的输入?
http://docs.python.org/2/library/functions.html#raw_input
title = raw_input("Please input your title here: ")
content = raw_input("Please enter your content here: ")