Skip to content
Advertisement

Tag: python

How do I remove ‘None’ items from the end of a list in Python

A have a list that might contain items that are None. I would like to remove these items, but only if they appear at the end of the list, so: I have written a function, but I’m not sure this is the right way to go about it in python?: Also a list comprehension as an alternative, but this seems

“django.core.exceptions.AppRegistryNotReady: Apps aren’t loaded yet” when trying to load data into my model

I am developing an app in Django. I want to load data inside my model, that is glossary_entry, but the data is stored inside an xlsx file, that is dati_prova.xlsx. In order to achieve this, I have developed the following script: But when I run it from Anaconda prompt, I get File “load_glossary.py”, line 7, in module … raise AppRegistryNotReady(“Apps

Combine f-string and raw string literal

I’m wondering how to use an f-string whilst using r to get a raw string literal. I currently have it as below but would like the option of allowing any name to replace Alex I was thinking adding an f-string and then replacing Alex with curly braces and putting username inside but this doesn’t work with the r. Answer You

Lost files while tried to move files using python shutil.move

I had 120 files in my source folder which I need to move to a new directory (destination). The destination is made in the function I wrote, based on the string in the filename. For example, here is the function I used. In the function, I am creating the destination folders, based on the ID’s derived from the files list.

puffadder (Lombok’s alternative for Python) not maintained?

I am looking for some Python library similar to Java’s Lombok. I found puffadder 0.1, from 2016, but now that I tried to install it with pip, it does not work. Links: https://pypi.org/project/puffadder/ https://libraries.io/pypi/puffadder https://github.com/IgniparousTempest/puffadder Shell output: So, is it not compatible anymore with modern versions of Python? Why is not in pip anymore, was it discontinued, or just lack

Advertisement