【发布时间】:2020-03-05 05:41:35
【问题描述】:
我收到了一个名为 input1.txt1 的文本文件,该文件包含以下内容
aspiration
classified
federation
graduation
millennium
philosophy
quadratics
transcript
wilderness
zoologists
编写一个程序,首先读取输入文件的名称,然后是两个字符串,表示搜索范围的下限和上限。应该使用 file.readlines() 方法读取文件。输入文件包含一个按字母顺序排列的十个字母字符串列表,每个字符串位于单独的行中。您的程序应该从列表中输出该范围内(包括边界)的所有字符串。
前:
Enter the path and name of the input file: input1.txt
Enter the first word: ammunition
Enter the second word (it must come alphabetically after the first word): millennium
The words between ammunition and millennium are:
aspiration
classified
federation
graduation
millennium
【问题讨论】:
-
到目前为止你尝试了什么?
标签: python