def main():
choice=raw_input("To convery from binary to words press w, to convery from words to binary press b: ")
theFile = open(raw_input("Enter File Name"),"rb")
if choice=="w":
''.join(chr(int(theFile[i:i+8], 2)) for i in xrange(0, len(theFile), 8))
if choice=="b":
' '.join(format(ord(x), 'b') for x in theFile)
main()
好吧,我有个错误。我不相信我读了正确的文件,并给出了正确的信息,我的两个如果语句。 二进制= 1001000 1100101 1101100 1101100 1101111 101100 100000 1010111 1101111 1110010 1101100 1100100 0100001 文本= 你好,世界
希望用户输入这两个文件中的一个
目前没有回答
相关问题 更多 >
编程相关推荐