推荐学习书目
› 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
Livid
396.81D
542.8D
V2EX  ›  Python

请教一个关于 Python 的 list 的问题

  •  
  •   Livid ·
    PRO
    · Apr 28, 2012 · 3524 views
    This topic created in 5265 days ago, the information mentioned may be changed or developed.
    - Python 的 list 是带顺序的 ordered list,对吗?
    - 如果使用 Pickle 进行序列化和反序列化,是否会影响其中元素的顺序呢?
    4 replies  •  1970-01-01 08:00:00 +08:00
    yuelang85
        1
    yuelang85  
       Apr 28, 2012   ❤️ 1
    不会影响。你可以序列化一下看看生成的字符串,是可以看出原始数据的。。。。
    Mattsive
        2
    Mattsive  
       Apr 28, 2012   ❤️ 1
    - The list type is a container that holds a number of other objects, in a given order.
    - Pickle 是把 object 转成字节流再还原 object 的,理论上 object 转换前后是完全一样的.
    phuslu
        3
    phuslu  
       Apr 28, 2012   ❤️ 1
    marshal的速度比pickle/cpickle要快些。
    reorx
        4
    reorx  
       Apr 28, 2012   ❤️ 1
    - 对的,这是Lists的基本特性。事实上,Lists是基础类别Sequences的衍生,也被称为“Mutable sequences“

    - 不会。可序列化的对象在被反序列化时,会完全还原为它被序列化时的状态。List中元素的顺序也会保持原样。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1392 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 93ms · UTC 16:30 · PVG 00:30 · LAX 09:30 · JFK 12:30
    ♥ Do have faith in what you're doing.