How to check for any special characters ($, @, %,& etc...) are present on an string, tuple, list or dictionary... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to check for any special characters ($, @, %,& etc...) are present on an string, tuple, list or dictionary...

How to check for any special characters ($, @, %,& etc...) are present on an string, tuple, list or dictionary like checking for numbers using "isnumeric()" * Im on python 3

31st Jan 2019, 7:14 PM
Vinod Damunupola
Vinod Damunupola - avatar
6 Answers
+ 5
from string import punctuation s = 'mmn@' print(any(p in s for p in punctuation)) # True
31st Jan 2019, 7:30 PM
Anna
Anna - avatar
+ 4
Try this code to see which characters will be found: https://code.sololearn.com/cJy4Al9Qu0Hu/?ref=app
31st Jan 2019, 7:41 PM
Anna
Anna - avatar
+ 3
You're welcome ☺️
31st Jan 2019, 7:42 PM
Anna
Anna - avatar
+ 2
Thanks a lot
31st Jan 2019, 7:41 PM
Vinod Damunupola
Vinod Damunupola - avatar
0
Is this method okay with all the asci characters except letters and numbers ?
31st Jan 2019, 7:39 PM
Vinod Damunupola
Vinod Damunupola - avatar
0
😎😎😁
31st Jan 2019, 7:44 PM
Vinod Damunupola
Vinod Damunupola - avatar