Hi i’m not an expert and this problem kept me stuck for such a long time I hope that someone here can help me i would like to exctract the value “interestExpense” from the following json file: In this case the result should be -130000000 as a string but i m trying to find a way to create an …
Tag: list
How to make list numbers by formula
hey everyone i have a question how i make a formula that makes my numbers in list specific first i need it to start whith number 4 then if if its higher than 6 it needs to restart from 0 it would look like this 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4
Indexing 2d lists in Python: Lengths in each dimension are not what I expect
If I create a 2d list: I would expect the list in the first element of foo to be accessed with foo[0] or foo[0][:]. Thus it’s length is 10, as expected: type(foo[:][0]) returns “list”. I would expect this to be a list constructed of the 0th elements from each “sublist” of foo. Th…
Python: convert dictionary into a cvs file
This is my current code: What I am trying to achieve is that the dictionary keys are turned into the csv headers and the values turned into the rows. But when running the code I get a TypeError: ‘string indices must be integers’ in line 21. Answer Problem The issue here is for row in data. This is…
How to make a boolean array by checking if the items in an array is in a list?
I’m trying to find every item in an numpy array arr that’s also in an arbitrary list lst and replace them, but while arr > 0 will generate a boolean array for easy masking, arr in lst only works with all() or any() which isn’t what I need. Example input: array (1, 2, 3, 4, 5), list [2, 4,…
Repeat list elements based in another list
I would like to repeat elements from one list based in a second list, like this: I’ve got this result: I’d like to get this result: Answer You may iterate on both list together, using zip, then increase i until you reach the bound of the current value
Is there a way to target a particular item in a list if it is not the first item [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 10 months ago. Improve this question So this is the issue: I want the function to print ‘yes’ as long as P0 is in t…
python3 join lists that have same value in list of lists
I have similar question to one that has been asked several years ago, the link is down here. the thing is that all answers are in python 2 and does work for me. my lists are huge so time is important. if anyone can solve that for python3, that will really help. Consider this list of lists: I want to
Searching for matching attributes
My special objects have one list of attribute-values (that is a varying list of abbreviated strings of short but differing length meaning some capabilities of any object) → [‘A’, ‘B’, ‘AC’, ‘BC’, …] running the program I’m searching for at least one …
How do I make it so that when I click it changes the list
I have a list full of colors; I’m trying to make it so that when I click a button, it moves over one position in a list, thus changing the color of a shirt. How would I make it so that when I click the button it shifts to the next value? e.g. (I know this is wrong, but do