我试图用Python编写一个代码,在这里我可以从两个关键字之间的所有单词中得到一个打印出来。scenario = "This is a test to see if I can get Python to print out all the words in between Python andwords"
end = "words"
我有一个句子列表,如下所示: sentences = ["I am learning to code", "coding seems to be intresting in python", "howto code in python", "practicing how to code is the key"] 现在,我希望使用字典及其替代项替换这个句子列表中的几个子字符串。()])
for
Python 3.5str1 = input("Please enter a full sentence: ").lower() print("Sorry, that word was not found")
实际上,它将搜索输入的单词(str2),如果在输入中找到它(str1 (一个句子)),它会说“已找到这个单词如果这个词
我有一个字符串: The exam is for testing your skills.The exam includes the following:2)synonyms
3)Reasoning 因此,我使用以下代码使用字符串方法来识别单词的索引: string.find('exam') 它为我提供了字符串中单词的索引。在这里,我必须确定每个句子末尾