I would appreciate your help on this scraping problem. I would like to scrape this site: https://www.trustedshops.de/bewertung/info_XDAD39B874C275A0751198C2510C3C670.html Although my code does not give me an error message, I do not see any output. I believe the problem is the bs.find_all statement; basically,…
Tag: python
Serialize a queryset including the ForeignKey values
models.py: views.py: I would like to return a json response with the content of ProjectManager + the content of the Project associated to that ProjectManager (ForeignKey). According to what I have read in the Django documentation, to do a left join, the best thing to do would be to use select_related. In fact…
Find and replace XML content in MS Word Document.xml with Python
I’m following the below guide to search a replace a keyword in the DOCX document.xml https://virantha.com/2013/08/16/reading-and-writing-microsoft-word-docx-files-with-python/ I’m trying to find ‘abc’ within the w:instrText tag and replace it with ‘zzzz’ Please find my code…
How to specify print location for PDF printing with Selenium
Whatever I do, the files keep getting printed into my Downloads (Windows default) folder, rather than specified folder. I did my research and apparently the savefile.default_directory option should be used rather than download.default_directory but it doesn’t work anyway. I tried removing the trailing \…
Create a customer converter and validator using ATTRS
I am trying to learn attrs and I have two questions. Please note that I am using the ATTRS library, not ATTR. How do I create a converter to change typ to uppercase? —> I solved this question. The formula below is updated. :) How do I create a validator to ensure that typ is contained within a list? …
Function failing to update spacing after comma
I have a csv file that has inconsistent spacing after the comma, like this: 534323, 93495443,34234234, 3523423423, 2342342,236555, 6564354344 I have written a function that tries to read in the file and makes the spacing consistent, but it doesn’t appear to update anything. After opening the new file cr…
How to search via Enums Django
I’m trying to a write a search function for table reserving from a restaurant, I have a restaurant model: which has a enum for kitchen_type: And this is the search function in view.py: So how am I able to search for kitchen_type in the view? Answer Instead of using a list of tuples I would recommend ext…
np.diag not including 0s in the array
I have an expression that yields the following result: I want to make a diagonal 2X2 matrix which has 0.5 and 0 on its diagonal. But when I use the following code: A being the above array, I get the following result: Why does python not include the second element from A on the array and how can I include
Is there a good way to cache apt and pip packages on my home network without changes to my clients?
I am testing and building a lot of containers over a somewhat slow internet connection. Every time I test a rebuild it has to re-download all the apt and pip packages. I have seen a couple solutions to cache locally with docker, but I need the build process to work for other developers and also during deploy.…
Combining various image channels after gaussian filtering produces white image
I am trying to implement a gaussian filter for an image with dimensions (256, 320, 4). I first generated a gaussian Kernel for the same and then individually perform the convolution on each of the 4 channel, i.e on all the 256*320 greyscale images. After performing this I wish to combine the image into a colo…