Hi,
I am absolutely a beginner in Python. How can I find an index of a regular expression pattern if it matches within a string? For example a string: 'abc:def' and I want to get the index of ':' (colon) using the regular expression such as r'[^\w\s]. JAVA supports regular expression in the version of 'indexOf ()' function. How these could be done in Python?
Thanks.
User Profile
Collapse
-
find the index of a pattern occurred in a string
-
OOPS! Sorry for that. Actually I got some errors in my regular expressions and assumed it as for that multiple 'if' statements!!!! Now I figured it out and solved it.
Sorry for the inconvenience :-) -
using multiple 'if' statements in Python
Hi All,
Can anyone please help me out about how can I use multiple 'if' statements in Python like C/C++?
For example in C:
*************** **************
int a;
a = 0;
if ( a == 0 ) {
printf "0";
a = 1;
}
if ( a == 1 ) printf "1";
*************** ***************
How can I write these statements in Python Code?
...
No activity results to display
Show More
Leave a comment: