skip to Main Content

Loop over JSON arrays in python

I wanted to loop over a section in my JSON File and render the geometry based on their names in the File. main.py import json data = json.load(open('src/test.json')) for geo in data["geometry"]: if geo == "rect: Geometry.rectangle(draw=pen, x=geo["x"], y=geo["y"], width=geo["width"],…

VIEW QUESTION

Debian – Convert text file that contains colon to json

Existing Code import json filename = 'thunar-volman/debian/control' dict1 = {} with open(filename) as fh: for line in fh: print(line) command, description = line.strip().split(': ') print(command) print(description) dict1[command.strip()] = description.strip() with open("test.json", "w") as out_file: json.dump(dict1, out_file, indent=4, sort_keys = False)…

VIEW QUESTION

Amazon web services – Partial credentials found in explicit, missing: aws_access_key_id

I am trying to run the following code snipet (based on this code here): import boto3, os from dotenv import load_dotenv load_dotenv() AWS_ACCESS_KEY=os.getenv('AWS_ACCESS_KEY') AWS_SECRET_KEY=os.getenv('AWS_SECRET_KEY') translate = boto3.client( service_name='translate', region_name='us-east-1', aws_access_key_id=AWS_ACCESS_KEY, aws_secret_access_key=AWS_SECRET_KEY, ) result = translate.translate_text(Text="Hello, World", SourceLanguageCode="en", TargetLanguageCode="de") print('TranslatedText: '…

VIEW QUESTION
Back To Top
Search