Custom Query (121 matches)
Results (19 - 21 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #132 | worksforme | PySyck does not dump dictionaries | xi | xl269@… |
| Description |
infinity0@xl269:~$ uname -a Linux xl269 2.6.30-1-amd64 #1 SMP Sun Jun 14 15:00:29 UTC 2009 x86_64 GNU/Linux infinity0@xl269:~$ python --version Python 2.5.4 infinity0@xl269:~$ python Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
'--- {}\n\n'
{1: 2}
'{1: 2}\n'
{1: 2} |
|||
| #167 | worksforme | Please help saving dict to yaml | xi | anonymous |
| Description |
Hi, is there any way of saving dict to a file in yaml format? I'm using:
----------------------------------------
#!/usr/bin/python
import yaml
y = """
root:
- subject1:
desc: msg1
- subject2:
desc: msg2
"""
settings=yaml.load(y)
settings['root'][0]['subject1']['desc'] = "new msg"
print settings
f = open("temp", "w")
f.write(str(settings))
----------------------------------------
but failing miserably, contents of the temp file:
{'root': [{'subject1': {'desc': 'new msg'}}, {'subject2': {'desc': 'msg2'}}]}
expected result:
root:
- subject1:
desc: new msg
- subject2:
desc: msg2
Is there anything like yaml.save? Any help greatly appreciated!
Regards,
Tomas
|
|||
| #21 | duplicate | yaml emitter bug | xi | rwb123@… |
| Description |
The following code produces bad yaml output, which subsequently dies in the yaml.load(). This is with pyyaml 3.0.3 on python 2.4.1. import yaml e = {"texas: '": 92.5} yammy = yaml.dump(e) print yammy e2 = yaml.load(yammy) print e2 The yaml output is: $ python yamlbug2.py
{'texas: '': 92.5}
Traceback (most recent call last):
File "yamlbug2.py", line 10, in ?
e2 = yaml.load(yammy)
File "/home/blahblah/dl/yaml/PyYAML-3.03/lib/yaml/__init__.py", line 61, in load
return loader.get_data()
... etc.
|
|||
Note: See TracQuery
for help on using queries.
