我不知道这部分代码有什么问题
if value.find("\\") > -1:
newstr = int(value.find("\\"))
print newstr
print value
print value[newstr:7]
newstr
和 value
都被正确打印,但是 value[newstr:7]
显示空白。
有什么想法吗?
最佳答案
value[newstr:7]
会给你从位置 newstr
到位置 7
。
也许你的意思是 value[newstr:newstr + 7]
?
关于未打印python子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11722854/