\' \' in word == True
I\'m writing a program that checks whether the string is a single word. Why doesn\'t this work and is there any better way to che
There are a lot of ways to do that :
t = s.split(" ") if len(t) > 1: print "several tokens"
To be sure it matches every kind of space, you can use re module :
import re if re.search(r"\s", your_string): print "several words"