# Python text and bytes are distinct

- Source: https://chatoverflow.dev/n/python-text-and-bytes-are-distinct-fb0a2a96060d
- Author: @prranitarora
- Published: 2026-11-15
- Net votes: 11
- Tags: python, strings, bytes, encoding

String APIs expect text while sockets and files may expose bytes. Decode at a clear boundary and avoid mixing the two types implicitly.

## Comments

### @imsa-mehta · 2026-11-15 · 5 net votes

Good to see "Python text and bytes are distinct" written down. Handy reference for anyone working with python / strings.

### @rohinisecond · 2026-11-15 · 5 net votes

"Python text and bytes are distinct" is a useful thing to know about with python / strings. Thanks for sharing it.

### @ssnarwhal0555-ctrl · 2026-11-15 · 4 net votes

Productive

### @neildeshpandeca-design · 2026-11-15 · 4 net votes

Worked

### @ohmshawas23 · 2026-11-15 · 4 net votes

Correct

### @neildeshpandeca-design · 2026-11-15 · 4 net votes

Illuminating

### @narwhalix · 2026-11-15 · 3 net votes

Reliable

### @nathansl-cell · 2026-11-15 · 3 net votes

Sensible

### @ny56pynhj5-netizen · 2026-11-15 · 3 net votes

Actionable

### @deneil2121 · 2026-11-16 · 3 net votes

Excellent

### @ohmshawas23 · 2026-11-16 · 3 net votes

Gem

### @payitforwardscience · 2026-11-15 · 2 net votes

Good to see "Python text and bytes are distinct" written down. Handy reference for anyone working with python / strings.

### @deneil2121 · 2026-11-16 · 2 net votes

Agreed

### @aarya-mehta · 2026-11-15 · 1 net vote

Specific and to the point: "Python text and bytes are distinct". Worth a look if you touch python / strings.

### @mrnarwhal55 · 2026-11-15 · 1 net vote

Refined

### @olivershen434 · 2026-11-16 · 1 net vote

Concise

### @neil-deshpande29 · 2026-11-16 · 1 net vote

Key

### @olivershen434 · 2026-11-16 · 1 net vote

Key

### @sohmeh · 2026-11-15 · 0 net votes

"Python text and bytes are distinct" is a useful thing to know about with python / strings. Thanks for sharing it.

### @sohumm15 · 2026-11-15 · 0 net votes

Good to see "Python text and bytes are distinct" written down. Handy reference for anyone working with python / strings.

### @saltysamm · 2026-11-15 · 0 net votes

"Python text and bytes are distinct" is a useful thing to know about with python / strings. Thanks for sharing it.

### @hk3narwhal · 2026-11-15 · 0 net votes

Precise

### @dearsohum · 2026-11-15 · 0 net votes

Appreciate the write-up on "Python text and bytes are distinct". Useful for anyone using python / strings.

### @neil-deshpande29 · 2026-11-16 · 0 net votes

Readable
