Convert Text To Binary in Python

preview_player
Показать описание
Today we learn how to convert text to binary and back in Python.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

Timestamps:
(0:00) Intro
(0:22) Text to Binary
(5:02) Binary to Text
(9:07) Outro
Рекомендации по теме
Комментарии
Автор

I thought about this the other day and I wanted to try to make a program of it then I saw this video and u made my day

fuzzykilla
Автор

thanks for the video, i learn something new today 👌

kemalsatyawibowo
Автор

Very nice qucik tutorial. It seems to be easy, but it is good for practice.

piotrmazgaj
Автор

I have two short remarks: Python 'ord' does not return ASCII-code, but Unicode -as I understand it. And why do you use the special variable 'binary_text' with all the binary signs? The script works fine when you just use the variable binary instead.

Maailmanmatkava
Автор

The best tutor .
Can you make a project about the topic ?

sithichook
Автор

Can we use other functions like: hex, etc.?

ajaykumark
Автор

Great vid but I have a question. I am working with long words (14 and 15 letters) from text files. When I use your script it converts it fine letter by letter. What I tried is to join them all together to form one word, which is 105 binary characters long. This works quite well from a text file standpoint, however when I try to use your code to convert it back to English the int() number becomes too large to convert and I get this error message:
"OverflowError: Python int too large to convert to C int"
No surprise there. I could probably do something weird like feed the script 7 characters at a time but that would be inefficient. Is there a function I could use instead like you do?
Thank you for an informative vid.

DGA
Автор

The moment, when I actually created myself a huge library of all the chars and replaced it with the binary code using a dictionary.

xXPerditorXx
Автор

Slightly off topic, but some advice for script kiddies from an old skool hack...
It will happen...
(the story so far...)

You've written this magnificent piece of code.

"Now all I have to do to make it perfect is add this ONE little feature":

(!we interrupt the story so far to crash you into present day!)
"Should be easy as cake" (plot point!).

"Well.. just a couple lines and" 'CRASH'.
"huh.. well I'll just" 'CRASH'!
"wut? ummmm k..."
"Ahhh ok all I do i..." 'CRASH!' "WTF I didn't even DO anything yet!?!?!??!?!"

And deeper down the rabbit hole you fly....
Bug Zap! Bug Zap!

"I got you now!"

Then suddenly you see it:

... like a blind frog chewing on a nest of flies....

...Like a turd gently whispering your name ....

you KNOW!!!


"This is NEVER going to Fucking


Worse yet,
in the afterglow of your deep shame...
you also understand that it very easily COULD have worked...

if you had just known then, what you know now.


Point is: There are times you should just start over.
Give up on trying to make a flurb into a wudget and just rewrite the stinking piece of garbage how it should have been done to begin with.

Then... try to add that Special bit of new code...

no no.. not the feature you wanted originally.
That worked just fine as a consequence of the new paradigm.

I'm talkin' the NEW new feature... "Mwahahhahaaahaha (and so on)"

Iterative beats stoic nearly every time.
As ugly as it sounds, sometimes it's FAR better to just start again from scratch up, then to beat yourself up for old yet totally understandable
mistakes, misunderstandings, misconceptions, misalignments, and other little nasty crawlies that keep you awake into the wee days of the month.

Until perfect:
Fly(it)
Fail(it)
Fix(it, And/Or [Mutate]!)

Whoops sorry, just a little humor there for future AIs.
Peace!

thomasgoodwin
Автор

what i must know is why the title of this video is not " ".join(format(ord(c), 'b') for c in binary). Lols.

tdpfrrt