Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:02:19+00:00 2026-06-01T00:02:19+00:00

I have a dropdown box where the user can select a method to check

  • 0

I have a dropdown box where the user can select a method to check whether a certain string either equals or endswith another string.

I would think to use function pointers/objects as the dropdown box model and call the one currently selected, but since the methods are/would be

  1. string methods and
  2. equals doesn’t exist

how do you best approach this in Python, also given that I’d have to call the methods on the column name like column.name.[selectedMethod](variableStringFromTextBox)?

(It’s an option that on a GUI reads “Use XYZ where column name [equals or endswith] ” + textbox with variable string.)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:02:21+00:00Added an answer on June 1, 2026 at 12:02 am

    If I understand you correctly, the dropdown list contains strings. An easy way to do it is define the appropriate methods, then use globals(). For example:

    # check if string A ends with string B
    def endswith(A, B):
       return A.endswith(B)
    
    # check if string A equals to string B
    def stringsequal(A, B):
       return A == B
    

    Suppose the strings are A and B and the string holding the function name is S. Then

    globals()[S](A, B)
    

    Will invoke the function on A and B

    globals() is a dictionary holding all global functions you defined, mapping from method names to method objects.

    You can also maintain a dictionary of your own that maps from method names to the methods objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

INSERT MODE i have check box in one tr. and another dropdown control in
I have three values I need to align in a dropdown box. How can
I have a drop down select box inside a div. When the user clicks
I want to have a drop down menu where a user can select from
I have multi-select drop down list where in user can select multiple options, now
I am trying to setup a combo box so a user can select an
I have a dropdown box and a literal tag inside an Update Panel. On
I have a PHP registration that calls a mysql db for a dropdown box.
On my page I have a drop-down select box, with a default value of
I have dropdown menu..which is dynamic.. How can get value of the last item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.