Python Forum
Find field name from all possible values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find field name from all possible values
#1
Hi all!

Here I am new my first post :)

I have started learning python.

I have question is there better solution, than this:
ols = dict(
  clicks='Hits,Clicks,clicks' # define all possible clicks alternatives 
)

results = dict(
  Hits=2
)

# find the field name by how to search in the results
clicks_col_name = [i for i in results if any(i == x for x in cols['clicks'].split(","))]
clicks = results[clicks_col_name[0]] if len(clicks_col_name) > 0 else None

print (clicks)
Reply
#2
How about starting off by describing what it is you are trying to do?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  find the sum of a series of values that equal a number ancorte 1 491 Oct-30-2023, 05:41 AM
Last Post: Gribouillis
  Any tips to how to find out values? nevlindan 1 717 Apr-27-2023, 09:14 PM
Last Post: deanhystad
  Loop through values in dictrionary and find the same as in previous row Paqqno 5 1,894 Mar-27-2022, 07:58 PM
Last Post: deanhystad
Question Find all values in drop down menu with bs4 DonaldBug13 1 4,015 Aug-06-2021, 06:16 PM
Last Post: Axel_Erfurt
  Bug ? when dataclass field name == field type Cyril 0 1,546 Oct-22-2020, 03:26 AM
Last Post: Cyril
  find a string in a field in MongoDB Leon79 2 2,410 Jul-19-2020, 09:20 PM
Last Post: menator01
  Find only the rows containing null values Bhavika 2 2,430 Jun-10-2020, 01:25 PM
Last Post: Bhavika
  python how to find difference between two values hare 1 6,445 Jan-14-2019, 10:18 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020