2014-04-14 85 views

回答

2
# use raw strings to ignore escapes: 
s = r'\sgoogle\s' 
print s, s.find(r'\s') != -1 

# and with regex: 
import re 
print re.search(r'\\s', s) 

給出:

\sgoogle\s True 
<_sre.SRE_Match object at 0x7f2d696fc850>