Category : dictionary

I want to take input from user for orgname, username, password and replace values in above mentioned Sample.py file. Sample file: try: functions.set_values(orgname=’Sample’, username=’Sample1′, password=’xyz’) except: bail(‘test failed’) Here is what I have : while True: try: org_data = {} orgname = str(input(‘Enter orgname: ‘)) username = str(input(‘Enter username: ‘)) password = str(input(‘Enter password: ‘)) ..

Read more

I’m trying to create some simple cfg file whit import json #write "function" exDict = {} data = {‘A’: ‘a’, ‘B’: ‘b’, } exDict = {"yellow": ‘apple’, "square": ‘ball’} with open(‘CONFG’, ‘w’) as file: file.write(json.dumps(exDict)) file.write(json.dump(data)) file.write(json.dumps(exDict)) file.write(json.dump(data)) Read functions trayed: open and read the file after the appending: f = open("CONFIG", "r") print(f.read()) Out ..

Read more

I have a (flat) text string that I want to translate into a python dictionary / json. Example string: key1=value key2="val ue" key3=[entry1, entry2] key4=["o ne", "[two]"] key5="value with a , or secial character#l" key6="text with a protected quotation " inside" key7=1,101,42 Output should be a dict/json looking like { "key1": "value", "key2": "val ue", ..

Read more

I would like to generate an XLSX file with keys and values from a Dictionary. Example bellow statistics = { "a:": f"textt", "b": " ", "c": f"{len(list_1)}", } df = pd.DataFrame( {‘Statistics’: pd.Series(statistics.keys()), ‘Statistics Values’: pd.Series(statistics.values())) writer = pd.ExcelWriter(f"{output_xlsx_file}", engine=’xlsxwriter’) df[‘Statistics’].to_excel(writer, sheet_name=’Statistics’, index=False) df[‘Statistics Values’].to_excel(writer, sheet_name=’Statistics’, startcol=1, index=False) The expected result is to have an ..

Read more

I have a dictionary with time stamp as key and boolean as value like : # Sample case secbysec_putaway = {’00:00:00′: False, ’00:00:09′: False, ’00:00:12′: False, ’00:00:25′: False, ’00:00:34′: False, ’00:00:45′: False, ’00:00:60′: False, ’00:01:05′: True, ’00:01:14′: True, ’00:01:21′ : False, ’00:02:19′ : False, ’00:02:22′: True, ’00:02:29′: True, ’00:02:34′: True, ’00:02:38′: False, ’00:02:44′ : True, ..

Read more