How to Convert Number to Binary In Python (bin() Function) - Python Quick Tips

How to Convert Number to Binary In Python (bin() Function) - Python Quick Tips

Tech With Tim

4 года назад

29,117 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Bachir Belkhiri
Bachir Belkhiri - 17.09.2019 01:05

You can use the base on the int() function to go backward just like that "int(bin(23)[2:], 2)"

Ответить
mitchellplays 122
mitchellplays 122 - 12.03.2023 19:37

no

Ответить
sergio nunes
sergio nunes - 27.04.2022 06:10

Algum BR🇧🇷 ?

Ответить
Roshvyn Singh
Roshvyn Singh - 26.08.2020 08:14

anyone know how to do this without using the in-built bin() method?

Ответить
ابن بطوطة
ابن بطوطة - 18.05.2020 18:08

>>> int(0b10111)
23

Ответить
Mohamed Fathy
Mohamed Fathy - 11.12.2019 20:29

Amazing

Ответить
CoderDude
CoderDude - 17.09.2019 08:24

You can make a text to binary program like this:
x = str(input())
x = ' '.join([format(ord(i),'b'] for i in x]).

You can also make it into a hex converter:
x = str(input())
x = ' '.join([format(ord(i),'h'] for i in x]).

Or an octal converter:
x = str(input())
x = ' '.join([format(ord(i),'o'] for i in x]).

Ответить
Mr. Tech Guy
Mr. Tech Guy - 17.09.2019 04:05

One of most useful tutorials...

💯💯💯💯

Ответить
Imtiaz Ahmad
Imtiaz Ahmad - 16.09.2019 21:37

Plz Make video on cryptography

Ответить
Sa Inco
Sa Inco - 16.09.2019 21:16

thanks.

Ответить
Mitanshu Reshamwala
Mitanshu Reshamwala - 16.09.2019 21:01

What happened to data structure videos

Ответить
Zárate Fernández Diego
Zárate Fernández Diego - 16.09.2019 20:35

I love this channel

Ответить
Suraj Sharma
Suraj Sharma - 16.09.2019 20:08

Sir please make tutorial on desktop application using tkinter module and also implement option menu

Ответить
Sala
Sala - 16.09.2019 19:44

More quick tips, please.

Ответить
ChettahZpeed
ChettahZpeed - 16.09.2019 19:38

You can use int to convert binary to an int,

a = 79
bin_a = bin(a)
print(int(bin_a, 2))
The 2nd param. tells it what base it is coming from

Ответить
Soumesh Khuntia
Soumesh Khuntia - 16.09.2019 19:37

This channel is awesome ...
Thanks Tim ...

Ответить
J
J - 16.09.2019 19:28

Great vid! Also, when is the tower defense part two coming?

Ответить
Sai Kiran Patro
Sai Kiran Patro - 16.09.2019 19:26

Nice stuff by u ..

Ответить
Random user
Random user - 16.09.2019 19:16

Another method : '{0:b}'.format(number)

Ответить
Alphabet
Alphabet - 16.09.2019 19:15

bin(number) -> Nice short tutorial video

Ответить
Pushpajit Biswas
Pushpajit Biswas - 16.09.2019 19:02

Can you make a playlist over opencv ? By the way awesome video 😍

Ответить
Neil Goyal
Neil Goyal - 16.09.2019 19:02

Hattrick!!

Ответить
Neil Goyal
Neil Goyal - 16.09.2019 19:01

first again!!!!

Ответить