Skip to content
Advertisement

Tag: base64

Get filetype from BASE64 file

What is the way to get file type from base64 string? I need a solution which will work on Windows and Linux(Centos7) E.G.: This is string ; eHh4eHh4 which is = to a text file with xxxxxx inside. If websites can do this, I guess it is possible to do it in python: https://base64.guru/converter/decode/file What I have tried: using magic

How to encode list of numbers as base64

I have a list containing negative numbers, and want to encode the list with base64. How can I do that? I tried: But I get the error: I expect the same output as my Java code: Answer The error arises because Python expects unsigned 8-bit data, which can be obtained with the modulo % operation: unsigned == signed % 2

Python Stream Decode Base64 to valid utf8

I’m currently working on a problem, which I just cannot seem to find the proper solution. Maybe you guys can help me, thanks! What I am trying to do Web is returning a JSON (value is encoded in valid BASE64, which was before that ùtf-8) requests.get(url, stream=True streaming from requests (chunks=1020) iter_content(chunk_size=1020, decode_unicode=False) do some chunk work (replacing everything with

base64 miss encodestring

I run in console python base64.py, get the below error message. but i can run it in textMate correctly. AttributeError: ‘module’ object has no attribute ‘encodestring’ Answer The name of your file should not be base64.py, it collides with the module you’re using. Rename your file, that should solve it.

Advertisement