Skip to content
Advertisement

Tag: python

Add a space after a word if it’s at the beginning of a string or if it’s after one or more spaces, and at the same time it must be at end or before n

How to obtain this outputs from those inputs? Note that for examples 4, 5, 6 and 7 the regex should not make any changes, since after the word there is already a space placed, or because in the case of “uno”, the word “un” is not at the end of the sentence, or in the case of “treinta yun” the

Iterate over Json with no list in python

I want to be able to iterate with the dictionary from Json that like how it is done with list. Getting below error. Expected: Should be able to use any of the key values inside for loop to iterate for each of the univ# block. ie., each univ# should a an item in for loop so that I can perform

Install packages in a certain order with Poetry

Is there a way to set the .toml file up so you will have the dependencies installed in a certain order with Poetry? Imagine I have the following .toml: How can I make sure wxPython always is installed first? Answer There is no way to tell Poetry to install packages in a certain order. The reason for this is, because

How to order dictionary based column?

I have a column that contains dictionary like below I need to write a Python code to sort each element in a column based on a value such as output will be like Can someone help with that please? I tried sorted function but it breaks at some point. Thank you! Answer I assume that Column_1 is a list:

Mock object without fields and methods

I have for example: Is possible to mock City object and still use street method as in other programming languages? I would like to achieve something like this: In short, I would like to mock the entire object so that it does not execute the constructor and that all fields and methods in the object work as before. Answer If

Issue with class declaration in python. Two classes with fields of each other

My code is something like this: and i have NameError: name ‘className2’ is not defined. I don’t know if there is a declaration in python like in c++, and you can call classes in any order. Please help me… full code: field Speciality.abit is calls AdmissionList and field AdmissionList.speciality calls Speciality. Answer I think i avoid that problem by adding

How to make label in st.multiselect bigger/bolder

I am looking to make the label of multiselect bigger / bolder, my code looks like this : I have tried adding this : from this page : https://discuss.streamlit.io/t/the-problem-changing-label-font-of-text-input-and-multi-select/23329 but all it does is display the text on my app like so : Am I doing this wrong? Could it be the streamlit version? Answer You should have the css

Advertisement