我正在寻找类似于 'str.isupper()' 但带有符号的函数?

I'm looking for a function that is like 'str.isupper()' but with symbols?

我正在寻找一个函数,它可以像 str.isupper() 一样做完全相同的事情,但使用像这样的符号:

symbols = '!@#$%^&*()-_+=`~;:\'[]{}|<>,./?'

foo = '@&(='

# and then a function somewhat like this

print(issymbol(foo)) # this should return true

谢谢!

对于单个字符,这只是 in 运算符:

print( char in symbols )

对于字符串,使用all方法:

print (all (char in symbols for char in foo) )