Python operators checking | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python operators checking

Is there any function for checking operators in a string, like we have string.punctuation for checking punctuation marks.

2nd Feb 2019, 7:01 AM
Justin P Mathew
4 Answers
+ 3
https://code.sololearn.com/c7m0khdpxHlS/?ref=app This is my way of doing it. It has a list of operators (which you can add more of by the way). It goes through this list, checking if the string has any of them.
2nd Feb 2019, 8:30 AM
Eragon1980
Eragon1980 - avatar
+ 1
@Eragon1980 I tried the same thing, but I want a predefined function like string.punctuation for checking punctuation in a string.
2nd Feb 2019, 7:23 PM
Justin P Mathew
0
Oh OK, I'll try to come up with something
2nd Feb 2019, 7:33 PM
Eragon1980
Eragon1980 - avatar
0
I don't think there is a built in function :(
2nd Feb 2019, 7:35 PM
Eragon1980
Eragon1980 - avatar