Is there a good way to check if a string is encoded in base64 using Python?
base64
Using Python RegEx
import re txt = "VGhpcyBpcyBlbmNvZGVkIHRleHQ=" x = re.search("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$", txt) if (x): print("Encoded") else: print("Non encoded")