Тёмный
No video :(

Bytes and Bytearray tutorial in Python 3 

DevDungeon
Подписаться 12 тыс.
Просмотров 64 тыс.
50% 1

Опубликовано:

 

15 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 51   
@antoniom1557
@antoniom1557 4 года назад
congratulations, I am Italian and I understand everything despite the poor understanding of the language. Quick and easy easy tutorial.
@gaminganime3887
@gaminganime3887 3 года назад
You are a life savor...i read all the documents and blogs but didn't understand a thing...and then i decided to watch your video...thanks and keep it up !!!
@ninjaguysvideos
@ninjaguysvideos 4 года назад
Good quality tutorial. Tremendously helpful for me. Keep it up!
@bhthllj
@bhthllj 4 года назад
Great video, good voice over both in quality and quantity
@hackercop
@hackercop 3 года назад
Thanks for making this. It really helped me
@tymothylim6550
@tymothylim6550 3 года назад
Thank you very much for this video! It was very clear and educational! :)
@arpankumarlahiri4180
@arpankumarlahiri4180 4 года назад
05:21 'dead beef'???
@Build_the_Future
@Build_the_Future 2 года назад
I have a bytearray(b'\x01\x03\x01) and when I try to .append(0x31) I get a bytearray(b'\x01\x03\x01\x011) Why not bytearray(b'\x01\x03\x01\x31 ? Any idea why I'm getting a /x011 at the end and not /x31
@DevDungeon
@DevDungeon 2 года назад
0x31 is decimal 49. 49 is ASCII for the character of '1'. Because the print statement will automatically convert any byte within ASCII range to its ASCII character, it is printing out the character '1'. Try appending 0x41 (decimal 65) which is the ASCII value for the letter A.
@g00dvibes47
@g00dvibes47 4 года назад
Lol, dude, strings are also immutable in Python. Nice video
@rolandburke5918
@rolandburke5918 3 года назад
Very good tutorial
@alexz3346
@alexz3346 4 года назад
Huge help!!
@Ali-hr8qu
@Ali-hr8qu 2 года назад
so wowly explained
@edu.paixao
@edu.paixao Год назад
Thank you!
@rau149
@rau149 2 года назад
Thank you very much! It helped to solve ny issue!!! :D
@reitumetsemphahlele1756
@reitumetsemphahlele1756 2 месяца назад
Thank you
@DanielNetSet
@DanielNetSet 4 года назад
very good explanation. thank you!
@pallavisaxena7496
@pallavisaxena7496 5 лет назад
If I want to use binary instead of hexadecimal formst
@domss1174
@domss1174 5 лет назад
really cool video!
@fickthissut
@fickthissut 2 года назад
In bytearray you could, for example, do something like this: mutable_bytes[0] = 0x12
@alirad8996
@alirad8996 Год назад
thank you so much
@ragtop63
@ragtop63 5 лет назад
This is a great super beginner tutorial. Now let's talk about real-world applications. Say you have a phrase, "I love burritos!" encoded in UTF-8. How do you convert that to binary and how do you read it back and "decode" it for human consumption?
@DevDungeon
@DevDungeon 5 лет назад
This is covered in other sections of the tutorial here: www.devdungeon.com/content/working-binary-data-python
@muhamedqasim5390
@muhamedqasim5390 3 года назад
How I can convert Byets to bainnary 01 I'm trying set default blob in sqlite3 with 'executescript()' method so the photo should convert to bainnary variable.
@sorryamerica
@sorryamerica 5 лет назад
Thanks this is useful for romhacking!
@DevDungeon
@DevDungeon 3 года назад
I would love to hear more about what you do with romhacking.
@BrendanMetcalfe
@BrendanMetcalfe 4 года назад
Nice vid thanks!
@homya4ek_291
@homya4ek_291 3 года назад
Thank u for tutorial
@stefanoblondi6372
@stefanoblondi6372 4 года назад
Great work very useful and explained well. I just started programming and this is happening to me: def int2bytes(value, length): result = bytearray() for i in range(0, length): result.append(value >> (i * 8) & 0xFF) result.reverse() print(result) int2bytes(580, 2) The expected result is b'x02-x44' instead I have b'-x02D' Can you help me?
@DevDungeon
@DevDungeon 2 года назад
It's converting the byte value to its ASCII equivalent during the print statement. 0x44 is the character D
@okay_1204
@okay_1204 4 года назад
Great tutorial, but when is this actually used and how?
@ccall48
@ccall48 3 года назад
Many iot devices talk in bytes and hex strings for returned values. For example you can send multiple sensor data in single byte array and chop the data out and convert it to a more readable format like decimal at the other end.
@DevDungeon
@DevDungeon 2 года назад
Some things that come to mind are: when doing low level file manipulation, reverse engineering, or working with custom network protocols
@asaf7132
@asaf7132 Год назад
Uploading python code to a lab satellite using a laser signal :)
@okay_1204
@okay_1204 Год назад
@@asaf7132 ah yes, this would help me with my daily routine
@MohammedAlmawali
@MohammedAlmawali 3 года назад
how to convert form bytearray to a normal string??
@AKHILESHKUMAR-nk2rk
@AKHILESHKUMAR-nk2rk 2 года назад
how do i convert an encrypted pdf to bytes object in python
@chl3137
@chl3137 4 года назад
Where does the part where each byte contains 8 bits come in?
@chucksaber8332
@chucksaber8332 3 года назад
A byte is a list of eight 0's and 1's (it does not need to be interpreted as a number encoded in binary but you can). There is a direct correspondence between those list of 8 bits and numbers 0-255 given by the binary representation of a number (base 2), for example 00000000 is 0, 00000001 is 1, and 11111111 is 255. Hexadecimal is another way of encoding numbers but it's base is 16, for example 00 is 0, 01 is 1, and ff is 255 (read Wikipedia article on hex but 0-9 is 0-9 and a-f is 10-15). It doesn't really matter from a mathematical standpoint how you write these things down because there are formulas that convert each one into the other and back again. That is a byte=a list of eight 0's and 1's = a number from 0-255 in binary = a number from 0-255 in hexadecimal = a number from 0-255 in standard base 10. All the same thing with just different notations. Some notations are just more useful in different contexts. (There are even more manifestations of a byte than this, in the loosest sense a byte (in this context) is 256 distinct symbols of one kind or another. In Java it's the numbers −128 to 127 for example lol.) So in the video each byte is represented by the two digits in hexadecimal after each "\x". They could have used eight 0's and 1's but that would have been really long for the same thing. That said, it seems like numbers between 0 and 255 would be easier to stick to for bytes though (C# does this).
@bennguyen1313
@bennguyen1313 3 года назад
Any suggestions for how once you've read in a binary file, how you would plot it? I'd like to be able to take any binary file, prompt the user if the data is 8, 16, or 32-bits big, msb/lsb endiness, and then plot every data element!
@DevDungeon
@DevDungeon 2 года назад
Python Pillow (PIL) will let you draw images and you can make graphs/plot with that. Probably matplotlib tool
@nocontentnoname5922
@nocontentnoname5922 4 года назад
Why would anyone need create an an arbitrary number of bytes each of value 0?
@ohnsonposhka9891
@ohnsonposhka9891 4 года назад
thanks
@arnobroy8901
@arnobroy8901 2 года назад
Bro where I write the commands.Cmd or other?
@atharavnarang594
@atharavnarang594 3 года назад
WHat cursor are you using ? plz send the link !
@DevDungeon
@DevDungeon 2 года назад
Not sure what mean. If you mean the yellow circle that shows up around the mouse cursor, that is something the video editing software (Screencast-o-matic) adds.
@atharavnarang594
@atharavnarang594 2 года назад
@@DevDungeon thats what I ment Thanks!!
@amitkanskar
@amitkanskar 4 года назад
ru-vid.com/group/PLCHhoeMq8DcAUMQ3vgiJ-zkVWPwdzz6nT Playlist link | Python Tutorial Series | Full Course for Beginners |
@michaelmclean2363
@michaelmclean2363 2 года назад
Discord Invite is invalid
@DevDungeon
@DevDungeon 2 года назад
www.devdungeon.com/discord should always be up to date
Далее
5 Useful Dunder Methods In Python
16:10
Просмотров 57 тыс.
Python 3 - Episode 25 - Working with binary files
21:28
Python Decorators in 15 Minutes
15:14
Просмотров 436 тыс.
Packaging Data Using Structs in Python
18:41
Просмотров 20 тыс.
Compiled Python is FAST
12:57
Просмотров 106 тыс.
Python: Lambda, Map, Filter, Reduce Functions
9:59
Просмотров 379 тыс.
Python Asynchronous Programming - AsyncIO & Async/Await
25:57
Understanding stdin, stdout, stderr in Python
11:53
Просмотров 12 тыс.