Sponsored Content
Full Discussion: A quick help on python dict
Top Forums UNIX for Beginners Questions & Answers A quick help on python dict Post 303032131 by panyam on Tuesday 12th of March 2019 08:44:20 AM
Old 03-12-2019
A quick help on python dict

Hi Team,
I'm new to python and working on a project.
I have an API call which returns a dict(got the dict.values() and converted to list) as shown below:

Code:
dict_values([OffsetAndMetadata(offset=66, metadata=''), OffsetAndMetadata(offset=107, metadata=''), OffsetAndMetadata(offset=189, metadata='')])

Any clue, how can I get only offset values, in deed I need a sum of those. I can write a "shell sed command" inside python and using os.command can get the work done, but looking for a cleaner python solution/hint.
Thanks,
Ravi
This User Gave Thanks to panyam For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

i need quick help???...please

hey guys i'm new in this world " unix " i wanna any websites can help me to learn unix or any websites i can download UNIX from it thanks :D (3 Replies)
Discussion started by: M_Hafez
3 Replies

2. Shell Programming and Scripting

Need quick help

I have one script that named testing.sh #cat testing.sh #/bin/bash echo "Enter your name:" read name #./testing.sh Enter your name: Sanjay What I need it should take Input in the same prompt(mean to say dun go for next line) like given below. #./testing.sh Enter your name:Sanjay ... (1 Reply)
Discussion started by: SanjayLinux
1 Replies

3. Shell Programming and Scripting

grep: can't open /usr/dict/words

Hi All, If I use the "/usr/dict/words" inside the shell script, It is showing the error as, grep: can't open /usr/dict/words How can we resolve it? Thanks & Regards, Raja (2 Replies)
Discussion started by: Rajakct84
2 Replies

4. Programming

Python: bash-shell-like less functionality in the python shell

Hello, Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells? Example: >>> import subprocess >>> help(subprocess) ... ... I'm hoping so as I hate scrolling and love how less works with... (0 Replies)
Discussion started by: Narnie
0 Replies

5. SuSE

"ssh suse-server 'python -V' > python-version.out" not redirecting

Okay, so I have had this problem on openSUSE, and Debian systems now and I am hoping for a little help. I think it has something to do with Python but I couldn't find a proper Python area here. I am trying to redirect the output of "ssh suse-server 'python -V'" to a file. It seems that no matter... (3 Replies)
Discussion started by: Druonysus
3 Replies

6. Shell Programming and Scripting

**python** unable to read the background color in python

I am working on requirement on spreadsheet in python scripting. I have a spreadsheet containing cell values and with background color. I am able to read the value value but unable to get the background color of that particular cell. Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies

7. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

8. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies
dictSetValue(3) 						    util/dict.h 						   dictSetValue(3)

NAME
dictSetValue - set/reset an items value. SYNOPSIS
#include <util/dict.h> NEOERR *dictSetValue(dictCtx dict, const char *id, void *value); ARGUMENTS
dict - dictionary to add pair to. id - identifier to insert/update value - value to store (may NOT be NULL) DESCRIPTION
Updates the <id>/<value> pair into <dict>. If <id> is not in <dict>, it is created. MT-Level: Safe if <dict> thread-safe. RETURN VALUE
None. SEE ALSO
dictDestroy(3), dictCleanup(3), dictReleaseLock(3), dictRemove(3), dictNext(3), dictCreate(3), dictSetValue(3), dictModifyValue(3), dict- Search ClearSilver 12 July 2007 dictSetValue(3)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy