skip to Main Content

How can I use substr on json object with for loop?

Could someone help on how to loop over response while using substr to get each variable. The variables would be Amount, Type, Balance, Date. I have the json response [ [ "AmountTypeBalanceDate", "$27.90Debit$6.3011/22/22, 3:32 PM", "$30.00Credit$34.2011/22/22, 5:13 PM", "$27.90Debit$4.209/12/22, 4:01…

VIEW QUESTION

Dynamic values within a JSON parameter using Python

To be clear, I am practicing my Python skills using CoinMarketCaps API. The below code works great: import json # 1 JSON string in list, works info_1_response = ['{"status": {"timestamp": "2023-01-25T22:59:58.760Z", "error_code": 0, "error_message": null, "elapsed": 16, "credit_count": 1, "notice":…

VIEW QUESTION

How to add sub item to json in for loop

I am trying to achieve the following json output: My current code: #!/usr/bin/env python3.9 import json complete_lst = [] url_lst = ['https://', 'https://', 'https://'] complete_lst.append({'title': 'Hello'}) for url in url_lst: complete_lst.append({'watch': {'Season1': {'url': url}} }) with open("Hello.json", "w") as file:…

VIEW QUESTION
Back To Top
Search