Python 3 bytes() and bytearray() built-in functions TUTORIAL

preview_player
Показать описание
Tutorial on how to use the bytes() and bytearray() built-in function from the Python 3 Standard Library.

Timestamps:
0:00-0:25 Intro
0:26-0:50 Strings
0:51-1:11 Integers
1:12 Iterables

📖 You can check out the Udemy course (Python Built-in Functions) here:

Documentation:

⚙️ Recommended Computer Gear:

✈️ Recommended Digital Nomad Gear:
Рекомендации по теме
Комментарии
Автор

I think the reason x = bytearray([1, 2, 3]).append(4) gives you None is because the method change is 'in-class' hence the method returns None (-> None) and the variable x has now been assigned to the return value. Hope that helps.

sotirigeorgiou
Автор

Remember:
- bytes() is a class.
- So an instance of the class must be created first
- Before it can be used

qwepoiqazplmzxcmnbqw
Автор

In my 32-bit python 3.7 install, there's a file that contains the line:
data = to_bytes(data)
which causes the error: "unicode strings are not supported"


It seems like "to_bytes" is defined in serialutil.py, but why does it fail... and why doesn't it use SELF (data = self.to_bytes(data))?

bennguyen
Автор

Hi brenden I understood this perfectly but I don’t really know what there used for I know what they are but I don’t really what there use is

n
Автор

bytes() and bytearray() are classes, not functions. Also, I wrote in my new project: "print(bytes, bytearray)" -> written in command line: "<class 'bytes'> <class 'bytearray'>".

vladumnik
Автор

How do you repeat the previous command line?
I am using arrow Up and Down, it does not work with me.

dinhomhm
Автор

Hare Krishna hare Krishna Krishna Krishna hare hare Hare ram hare ram ram ram hare hare

mathsclassesbyomsir
Автор

Brother, why didn't you answer me?

elarapy