Created
September 16, 2019 04:33
-
-
Save serverwentdown/2cec8f77d8cef6c9dade2e236e5c8e0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = 'actgactgactggatc' | |
m = { | |
'a': 0, | |
'c': 1, | |
't': 2, | |
'g': 3 | |
} | |
bytestring = [] | |
for b in range(0, len(s), 4): | |
byte = 0 | |
for p in range(0, 4): | |
byte += (4**(3-p)) * m[s[b+p]] | |
bytestring.append(byte) | |
print(bytes(bytestring)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment