How do i finda spl character in a string and return found one..?

Manise.Saragih commented: i love +0

Your question isn't very clear; can you provide a sample input/output for the use case in consideration?

Create a tuple of special characters you will be checking for. Create a for loop and use string.find()
Maybe you can implement it as follows:

test="How are you?!!!#"
#Say you have a list of chrs like @,#,$,!,%,^,&,* etc
spl_chr='!'#If you are looking for !
loc=test.find(spl_chr)
if loc==-1:
    print "not found"
else:
    print "Found spl caracter at "+loc

Thats all. For more special characters you can create an array of spl characters and check for each one in a loop

i did something like this

strng = '1002-1004,1 1444'

[each for each in strng.split("-")[-1] if each in [',',' ','*','"','#','-']

i don't rememeber how i did in workplace, but it was better ..

this was it
import re

[char for char in strng if re.search(r"[^a-wy-zA-WYZ0-9]",char)]

Shorter.

>>> strng = '1002-1004,1 1444'
>>> re.findall(r'\W', strng)
['-', ',', ' ']

Or the same without regex.

>>> strng = '1002-1004,1 1444'
>>> [c for c in strng if c in ['-', ',', ' ']]
['-', ',', ' ']

you dont even understand the code man...