Welcome, guest | Sign In | My Account | Store | Cart
#!/usr/bin/python3
# Author: pantuts

binary = []
def strBin(s_str):
	for s in s_str:
	    if s == ' ':
	        binary.append('00100000')
	    else:
	        binary.append(bin(ord(s)))
s_str = input("String: ")
strBin(s_str)

b_str = '\n'.join(str(b_str) for b_str in binary) # print as type str
# replace '\n' to '' to output in one line without spaces, ' ' if with spaces

print(b_str.replace('b',''))

Diff to Previous Revision

--- revision 1 2012-10-17 17:48:47
+++ revision 2 2014-07-30 07:20:22
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 # Author: pantuts
-# Email: pantuts@gmail.com
 
 binary = []
 def strBin(s_str):

History