Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Christina ✅ 🇨🇦 (cosullivan@mastodon.sdf.org)'s status on Tuesday, 23-Oct-2018 12:18:53 EDT Christina ✅ 🇨🇦 Christina ✅ 🇨🇦

    Aim: to open a text file, read its hexadecimal contents, convert each hexadecimal line to ascii, print ascii code.
    Assume binascii module imported

    my code: code=txt.read().replace('\n', '').replace('\r', '').replace(' ', '')
    code.strip()
    for chunk in code:
    print(binascii.unhexlify(chunk))

    Output: binascii.Error: Odd-length string

    How do I fix this? Why are 'strip' and 'replace' insufficient?

    In conversation Tuesday, 23-Oct-2018 12:18:53 EDT from mastodon.sdf.org permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.