Foundations

Small scripts

35 min

When you repeat a step ten times, write a script.

import base64
data = 'SGVsbG8='
print(base64.b64decode(data).decode())

Useful pieces

  • open('file').read() reads a file
  • for line in text.splitlines(): loops over lines
  • bytes.fromhex('48656c6c6f') turns hex into bytes

Try it

Write a script that reads a file with one Base64 string per line and prints each decoded line.