Skip to content
Advertisement

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

Connect to Firebird database as read-only

I want to connect to a Firebird database read-only (because the location where the .fdb is read-only for my application. I connect like this: The error I am getting is: Error while connecting to database:n- SQLCODE: -551n- no permission for read-write access to database /path/to.fdb’, -551, 335544352 I am using FDB v2.0. I couldn’t find anything in the online documentation

How to check if permutation of a string is a palindrome

Im new to python and im trying to check if any permutation of a string is a palindrome. Here is my code: The problem I am having is that it I dont want my set to include spaces or any puncuation thats in the string. Is there any way to only check the letters? For example, the string “Mr. owl

“asyncio.run() cannot be called from a running event loop” when using Jupyter Notebook

I would like to use asyncio to get webpage html. I run the following code in jupyter notebook: However, it returns RuntimeError: asyncio.run() cannot be called from a running event loop What is the problem? How to solve it? Answer The asyncio.run() documentation says: This function cannot be called when another asyncio event loop is running in the same thread.

Pandas ‘partial melt’ or ‘group melt’

I have a DataFrame like this and I want to transform it into something like this This is an unpivot / melt problem, but I don’t know of any way to melt by keeping these groups intact. I know I can create projections across the original dataframe and then concat those but I’m wondering if I’m missing some common melt

Advertisement