string edit
-
This post is deleted! -
@radossslaw Please give an example of what the content of data is.
And does it simply not work, or do you get an error message?
Edit: And shouldn't you print int_x and int_y? -
string is b'22' error is 2 line in this code
-
This post is deleted! -
@radossslaw a few comments, not related to the error message:
- The code piece you show has no line 54.
- the indentation of the first line seems to be wrong
But this starting section is odd:
num=data num=int(num) num=str(num) x=num[0] y=num[1:3]It starts with data, which is a bytearray. Converting it to int() and back to str() makes it a string with whitespace stripped. You would get the same with: num = data.strip().decode(). Then you take two substrings, x and y.
These are not numbers. And I guess, that you uses these later in the code, e.g. in line 54, in a comparison with a number, which fails. -
This post is deleted! -
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login