Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast benedict to dict #3

Closed
abashind opened this issue Dec 9, 2019 · 4 comments
Closed

Cast benedict to dict #3

abashind opened this issue Dec 9, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@abashind
Copy link

abashind commented Dec 9, 2019

I’m trying to write benedict object to yaml file, and there is one problem.
Benedict.to_yaml add “!!python/object/new:benedict.dicts.benedict\ndictitems:” into yaml file.
How can I cast benedict object to “simple” dictionary, which will look like initialy dictionary?
Or how can I write benedict to yaml without “!!python/object/new:benedict.dicts.benedict\ndictitems:” and keypath_separator:.\n ?

I would like to see in benedict object, member like "python_dict", in order to it would be possible make call like:

my_dict = benedict_object.python_dict
type(my_dict ) is dict
True

@abashind abashind added the enhancement New feature or request label Dec 9, 2019
@fabiocaccamo
Copy link
Owner

@abashind which python-benedict version are you using?

@abashind
Copy link
Author

abashind commented Dec 9, 2019

@fabiocaccamo I think, current - 0.13.0

@fabiocaccamo
Copy link
Owner

I don't think you have 0.13.0 version, this issue should have already been fixed.
Please run pip install python-benedict==0.13.0 and check if your problem persists.

If you need to check an object type:

my_dict = benedict()
if isinstance(my_dict, dict):
   print('Yes, my benedict object is a dict!')

or is there something in your request that I'm not understanding?
If yes, could you explain it better?

@fabiocaccamo
Copy link
Owner

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants