| | |
String search function
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 198
Reputation:
Solved Threads: 0
Hi All,
I am using the .search function.
Python is not able to recognise the .search function.
AttributeError: 'str' object has no attribute 'search'
What should I import for this?
Please help!
I am using the .search function.
python Syntax (Toggle Plain Text)
strValue="XXX" strTemp1="YYYXXX" strTemp= strTemp1.search(strValue)
AttributeError: 'str' object has no attribute 'search'
What should I import for this?
Please help!
Last edited by Tekmaven; May 30th, 2009 at 3:11 am. Reason: Code Tags
If you want to just find out if one string is contained inside another:
If you want to find out how many occurrences of one string there are in another:
If you want to find the index of the first occurrence of one string in another:
python Syntax (Toggle Plain Text)
strvalue1 in strvalue2
If you want to find out how many occurrences of one string there are in another:
python Syntax (Toggle Plain Text)
num = strvalue.count(strvalue2)
If you want to find the index of the first occurrence of one string in another:
python Syntax (Toggle Plain Text)
ind = strvalue1.find(strvalue2)
![]() |
Similar Threads
- Adding a search function (Visual Basic 4 / 5 / 6)
- Creating a new file type - and creating Search function (C#)
- Search Function Troubles (C++)
- Need help adding a search function. (C++)
- Search string array (C++)
- can't open folders w/o search function popping up (Windows NT / 2000 / XP)
- i can't seem to make my search function work.... help!... (C)
Other Threads in the Python Forum
- Previous Thread: how to create a web site using python lang.
- Next Thread: any ideas?
| Thread Tools | Search this Thread |
address aliased anydbm app bash beginner bits calling casino changecolor cipher clear conversion coordinates corners count cturtle curves definedlines development dictionary digital dynamic events examples excel external feet file float format function gui handling hints homework iframe images import input java keycontrol line linux list lists loan loop matching mouse multiple number numbers output parsing path port prime programming projects py py2exe pygame pymailer python random rational raw_input recursion recursive scrolledtext searchingfile shebang signal singleton split string strings tails terminal text threading time tlapse tooltip tuple tutorial type ubuntu unicode url urllib urllib2 valueerror variable web-scrape whileloop word wxpython xlwt






