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 108049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:51:02+00:00 2026-05-11T01:51:02+00:00

I have a very tricky situation (for my standards) in hand. I have a

  • 0

I have a very tricky situation (for my standards) in hand. I have a script that needs to read a script variable name from ConfigParser. For example, I need to read

self.post.id 

from a .cfg file and use it as a variable in the script. How do I achieve this?

I suppose I was unclear in my query. The .cfg file looks something like:

[head] test: me some variable : self.post.id 

This self.post.id is to be replaced at the run time, taking values from the script.

  • 1 1 Answer
  • 3 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. 2026-05-11T01:51:03+00:00Added an answer on May 11, 2026 at 1:51 am

    test.ini:

    [head] var: self.post.id 

    python:

    import ConfigParser  class Test:   def __init__(self):       self.post = TestPost(5)   def getPost(self):       config = ConfigParser.ConfigParser()       config.read('/path/to/test.ini')       newvar = config.get('head', 'var')       print eval(newvar)   class TestPost:   def __init__(self, id):       self.id = id  test = Test() test.getPost()   # prints 5 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am in a very tricky situation.. I have a page that is a
I have one very tricky issue that I am not able to sort out
That's tricky. I have a small button over a very big one. When the
Here is very tricky situation i have tried many things but cant figure it
I have a very tricky assignment. There is a webpage that uses frameset. I
I have what seems to be a very tricky situation. I would like to
I have a very tricky problem going on with content inside a textarea on
We've got into a very tricky scenario in a project. We have used lot
I have very simple OpenGL ES example similar to Hehe's example : http://nehe.gamedev.net/tutorial/ios_lesson_02__first_triangle/50001/ As
I have a tricky situation where I need to duplicate a table row, and

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.