V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
dbas
V2EX  ›  Python

从新开贴研究,刚才发错,不知为什么没有添加功能了。

  •  
  •   dbas · Dec 3, 2014 · 2629 views
    This topic created in 4176 days ago, the information mentioned may be changed or developed.
    a = """(u'one',{u'a':u"1",u'b':u'2'})
    (u'two',{u'ass':u"f1",u'cb':u'2df'})

    """

    我如何才能得到{}字典里的数据
    1 replies    2014-12-04 00:09:40 +08:00
    billlee
        1
    billlee  
       Dec 4, 2014
    在确定字符串安全的情况下
    list_a = a.split('\n')
    for item in list_a:
    ....obj = eval(item)
    ....dictionary = obj[1]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   871 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 21:40 · PVG 05:40 · LAX 14:40 · JFK 17:40
    ♥ Do have faith in what you're doing.