Skip to content

Tag: python

How to remove this warning from VScode python code?

In my python code, I see the following warning all over the place; How do I remove this warning? I am using VS code v1.64.0, Microsoft Python Extension for Visual Studio Code v2022.0.1786462952. Answer From the hints provided in the comments, I managed to find an answer to my question. Edit settings.json foun…

Python-Tkinter: How do I update a whole segment?

I have a segment in my GUI that creates a varying number of labels using a for-loop. Furthermore, I have a button that’s supposed to delete all of these labels and recall the for loop with new information. However, I can’t figure out how to make my button do that. Specifically do both of these act…

Unittesting python?

I have some function with api I have some integration tests: Please could you show how Unittest will look like relatively mine function . Answer Solution Use unittest.mock module. More details can be found here. Explanation patch replaces a real object or function with a mock one. It requires a positional arg…

How to sort the contents of a list?

I have the following list: I need to make a list of book titles ordered by year, with the underscore character and the year removed. For example, the first book title should be “SecretOfChimneys”. Call your list booktitles. Is there a way to use the fact that titles are already sorted by year in b…