1

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.

Any ideas?

1
  • nothing, fixed it =) should be newstr Commented Jul 30, 2012 at 13:50

1 Answer 1

4

value[newstr:7] will give you from position newstr up to position 7.

Perhaps you meant value[newstr:newstr + 7]?

Sign up to request clarification or add additional context in comments.

1 Comment

I want to get a substring beginning from where I found a "\" plus 7 positions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.