推荐学习书目
› 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
liuxurong
V2EX  ›  Python

Python 2.7.3 有什么办法输入 é

  •  
  •   liuxurong · Aug 12, 2012 · 5546 views
    This topic created in 5198 days ago, the information mentioned may be changed or developed.
    我用Windows 自带的IDLE

    输入

    >>> a = "é"
    Unsupported characters in input

    会出现这个错误。

    我已经保存文件为UTF-8,并在头部加上#-*-coding:utf-8-*-,#-*-encoding=utf-8 仍是不行。

    如果不能换Python3,

    怎么办?
    17 replies  •  1970-01-01 08:00:00 +08:00
    lilydjwg
    lilydjwg
    Aug 13, 2012❤️2
    1
    不要用 IDLE。
    liuxurong
    liuxurong
    OP
    Aug 13, 2012
    2
    a="é"

    a="é"

    诡异。第二个可以,第一个就出现上面的错误。
    liuxurong
    liuxurong
    OP
    Aug 13, 2012
    3
    fanzeyi
    fanzeyi
    Aug 13, 2012
    4
    a = u"é"

    ?
    fanzeyi
    fanzeyi
    Aug 13, 2012❤️1
    5
    a = 'e\xcc\x81'

    a = u'e\u0301'

    ...
    ljbha007
    ljbha007
    Aug 13, 2012❤️1
    6
    字符串前加u
    liuxurong
    liuxurong
    OP
    Aug 13, 2012
    7
    @fanzeyi
    a=u"é"
    Unsupported characters in input
    liuxurong
    liuxurong
    OP
    Aug 13, 2012
    8
    @fanzeyi 乱码

    a = 'e\xcc\x81'
    >>> print a
    e虂
    fanzeyi
    fanzeyi
    Aug 13, 2012
    9
    @liuxurong u'e\u0301' 呢?
    liuxurong
    liuxurong
    OP
    Aug 13, 2012
    10
    @fanzeyi 这一个可以... 我有个文件名带有那个字符.. open不了..非用那个不可
    fanzeyi
    fanzeyi
    Aug 13, 2012❤️1
    11
    @liuxurong 嘛…… Windows 这种奇怪的系统出现这样的问题不足为奇
    est
    est
    Aug 13, 2012
    12
    用这个 u'\xe9'

    严格的说LZ的 é 是 e 加上一个 diacritical mark
    BOYPT
    BOYPT
    Aug 13, 2012❤️1
    13
    Off topic 一下: “Windows 自带的IDLE” ...
    tywtyw2002
    tywtyw2002
    Aug 13, 2012
    14
    a = u"é"
    clowwindy
    clowwindy
    Aug 14, 2012
    15
    用 cygwin 里的 python console。
    lilydjwg
    lilydjwg
    Aug 14, 2012
    16
    @liuxurong 第一个是组合字母(由两个码点组成)。总之呢,不要用 IDLE,难用死了。为了替换掉 Windows 上更难用的 cmd.exe,我特地写了个通过网络在 Linux 上进行行编辑的程序(见我博客或 github)。
    suckli
    suckli
    Aug 14, 2012
    17
    可以使用gvim
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3070 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 04:39 · PVG 12:39 · LAX 20:39 · JFK 23:39
    ♥ Do have faith in what you're doing.