Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

text to binary python

test_str = "GeeksforGeeks"
  
# printing original string 
print("The original string is : " + str(test_str))
  
# using join() + ord() + format()
# Converting String to binary
res = ''.join(format(ord(i), '08b') for i in test_str)
  
# printing result 
print("The string after binary conversion : " + str(res))

#out put example 11000001  8bit
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #text #binary #python
ADD COMMENT
Topic
Name
4+4 =