Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation mentions .sub() function on bytes which doesn't exist. #41

Closed
otac0n opened this issue Jan 4, 2020 · 1 comment
Closed

Comments

@otac0n
Copy link

otac0n commented Jan 4, 2020

From what I've gathered, .sub() appears to be a regex specific function. I believe the correct function for the 'bytes' type is .replace().

e.g.

  blob.data = blob.data.sub(b"Hello", b"Goodbye")

should instead be

  blob.data = blob.data.replace(b"Hello", b"Goodbye")
@newren
Copy link
Owner

newren commented Jan 4, 2020

Indeed, you can call bytes.replace(old, new) or re.sub(regex, replacement, old), but you can't mix-and-match and call bytes.sub(). Whoops. Fixed now; thanks for the report.

@newren newren closed this as completed Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants