Y
ygao
my question is as title!
thanks!
thanks!
ygao said:my question is as title!
Trues = "g"
t = ""
s[0:0+len(t)] == t True
s[1:1+len(t)] == t
ygao said:my question is as title!
my answer as code:
Trues = "g"
t = ""
s[0:0+len(t)] == t True
s[1:1+len(t)] == t
my question is as title!
thanks!
Steven said::
my question is as title!
my answer as code:
s = "g"
t = ""
s[0:0+len(t)] == t
True
s[1:1+len(t)] == t
True
Or in other words, imagine that Python is walking the string looking to
match the target. The empty string matches the boundary of every character
with the next character, or in other words, for a string s of length N,
s.count('') will equal N+1.
I'm not sure what to describe this surprising result as. It isn't a bug;
it isn't even really a gotcha. I guess the best description is that it is
just a surprising, but logical, result.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.