Ref #97: Replace built-in shadowed str
This commit is contained in:
@ -5,11 +5,11 @@ tags: string, beginner
|
||||
|
||||
Returns the length of a string in bytes.
|
||||
|
||||
Use `string.encode('utf-8')` to encode the given string and return its length.
|
||||
Use `input_string.encode('utf-8')` to encode the given string and return its length.
|
||||
|
||||
```py
|
||||
def byte_size(string):
|
||||
return len(string.encode('utf-8'))
|
||||
def byte_size(input_string):
|
||||
return len(input_string.encode('utf-8'))
|
||||
```
|
||||
|
||||
```py
|
||||
|
||||
Reference in New Issue
Block a user