Merge pull request #46 from sidagrawal/patch-1

Update byte_size.md
This commit is contained in:
Angelos Chalaris
2019-03-30 10:23:03 +02:00
committed by GitHub

View File

@ -2,7 +2,7 @@
Returns the length of a string in bytes.
`utf-8` encodes a given string and find its length.
`utf-8` encodes a given string, then `len` finds the length of the encoded string.
```python
def byte_size(string):
@ -12,4 +12,4 @@ def byte_size(string):
```python
byte_size('😀') # 4
byte_size('Hello World') # 11
```
```