Skip to content

Writing HTML Entities to a File

I’m getting a UnicodeEncodeError when I run the code below. It simply loops until i = 9000, appends an html entity to a list based upon the value of i, then writes the list to a file after looping. Doe’s anyone know where I’m going wrong? Answer By default this open method doesn’t supp…

IndexError: Target 1 is out of bounds

When I run the program below, it gives me an error. The problem seems to be in the loss function but I can’t find it. I have read the Pytorch Documentation for nn.CrossEntropyLoss but still can’t find the problem. Image size is (1 x 256 x 256), Batch size is 1 I am new to PyTorch, thanks. Error: A…

Python discord bot using discord.py problem

I’m trying to make a discord bot using the module discord.py, but I’m running into an issue and I’m unable to fix it. What I’m trying to do is that when someone pings the bot, he answers his prefix, I got that working with : However none of the code after that works: , so I cannot use …

How to use colormap in subplots?

For a project, I’m trying to plot on the same figure (using subplots) to “graph”. The data have been collected using a database (but for my problem here, I tried to selected only reasonable number of value). On the left of the figure, I plot the temperature in JFK during 10 consecutive days …

how should i scrape href links from this website?

I’m trying to get every products individual URL link from this link https://www.goodricketea.com/product/darjeeling-tea .How should I do that with beautifulsoup? Is there anyone who can help me? Answer To get product links from this site, you can for example do: Prints:

Python Import Excel List

I have the following list in Python: I now want to save these into an Excel and then read them in. How can I do this? I have not found such a “simple” import with Google, mostly it is more complex imports of Excel files. Thanks Serpiente32 Answer Here is a sample code: Output: Note: You should nev…

Trying to import a script from other code

I need help to import a script, i did 2 codes, the first is a test with some prints and in the second i try to import them: Code 1 Code 2 But in code 2, when i did os.system(r”python C:UsersGabriPycharmProjectspythonProjectImagens.py”) nothing happen. Someone can help me to import this code? ;-; 1…