No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Below is a part of my program which allows me to search for a word in a given text. However I would like to search for multiple words, or even be able to enter a sentence instead of just a word. Thank you for any help you can provide. [ICODE]def … | |
I would like to make a selection menue for 2 programs that i have. A menu similar to the one below. [CODE]import sys print """Menu 1) Random 2) Search""" answer = raw_input("Make a selection> ") if "1" in answer: print "This will contain program 1" elif "2" in answer: print … | |
I am trying to search for a word out of these 2 Principles. But by code displays both of the principles not just one. How could I make it display [U]only[/U] the principle where the word is located. [CODE] import re patterns = [ 'work' ] text = """\ 1. … | |
SyntaxError: invalid syntax (on else) Any help? [CODE]import re words = ['cats', 'cates', 'dog', 'ship'] for l in words: m = re.search( r'cat..', l) if m: print l else: print 'none' [/CODE] | |
I am trying to search for a word or multiple words out of the given text. How could i assign different words to each principles so if the word searched for is amongst the assigned text that particular paragraph will be triggered. Any help will be greatly appriciated. Thank you. … | |
What this program is does is search the text and where the word appear it displays the line. However. I am recieveing a [U]SyntaxError: EOF while scanning triple-quated string literals[/U]. When i try to run in on python 2.6. I dont have a an option of changeing versions. Just need … |