[英]python substring not being printed
I can't figure whats wrong with this part of code 我无法想象这部分代码有什么问题
if value.find("\\") > -1:
newstr = int(value.find("\\"))
print newstr
print value
print value[newstr:7]
the newstr
is being printed correctly as well as the value
but the value[newstr:7]
show blank. 正在正确打印newstr
以及value
但value[newstr:7]
显示为空白。
Any ideas? 有任何想法吗?
value[newstr:7]
will give you from position newstr
up to position 7
. value[newstr:7]
将从位置newstr
到7
。
Perhaps you meant value[newstr:newstr + 7]
? 也许你的意思是value[newstr:newstr + 7]
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.