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

你为什么非要 -*-

  •  
  •   master13 · Jan 5, 2016 · 5125 views
    This topic created in 3954 days ago, the information mentioned may be changed or developed.
    • 声明 python 源代码编码有很多种方法,明明#coding:utf8多简洁,你为什么非要用#-*- coding: utf-8 -*-,是因为它看起来更萌吗??!!!

    • 你看这里,人家都说了,只要 the first or second line must match the regular expression coding[:=]\s*([-\w.]+),匹配上这玩意就行。

    • 你喜欢萌,为什么不#-_- coding:utf8 -_-

    • #O(∩_∩)O coding:utf8 O(∩_∩)O 这个更萌!!

    19 replies  •  2016-01-08 10:34:02 +08:00
    master13
    master13
    OP
    Jan 5, 2016
    1
    #(๑¯ω¯๑) coding:utf8 (๑¯ω¯๑)
    lao454490095
    lao454490095
    Jan 5, 2016
    2
    楼主好样的,以后试试 #O(∩_∩)O coding:utf8 O(∩_∩)O ,哈哈哈哈
    chmlai
    chmlai
    Jan 5, 2016
    3
    编辑器自动补全的
    vanxining
    vanxining
    Jan 5, 2016 via Android
    5
    我也不知道啊,大家都这用的。原来还有其他用法……
    florije
    florije
    Jan 5, 2016
    6
    楼上是来源正解,不过 LZ 也说的对,毕竟一般的使用哪种写法就足够了。
    Tink
    Tink
    Jan 5, 2016
    7
    我同三楼,编辑器自动的
    florije
    florije
    Jan 5, 2016
    8
    @florije ……看一眼的功夫多了个 5 楼,只能说 4 楼正解了。
    9hills
    9hills
    Jan 5, 2016
    9
    你喜欢萌,为什么不#-_- coding:utf8 -_-
    以后就用这个了
    Hello1995
    Hello1995
    Jan 5, 2016 via Android
    10
    这是 emacs 字符集相关的历史遗留问题…
    GHfan
    GHfan
    Jan 5, 2016
    11
    表示,在项目里一直推荐他们用 #coding:utf8
    我要用 #-_- coding:utf8 -_- 报复他们!!
    tobyxdd
    tobyxdd
    Jan 5, 2016 via Android
    12
    #😃 coding: utf-8 😃
    mengzhuo
    mengzhuo
    Jan 5, 2016
    13
    vim 自动补齐的……
    bertonzh
    bertonzh
    Jan 5, 2016
    14
    #+_+ coding:utf8 +_+
    clino
    clino
    Jan 5, 2016
    15
    #ლↀѡↀლcoding: utf-8ლↀѡↀლ
    zhsj
    zhsj
    Jan 6, 2016 via Android
    16
    pep0263 里说了啊,为了方便各种各样的编辑器识别啊。。。。

    line in the file, such as:

    # coding=<encoding name>

    or (using formats recognized by popular editors)

    #!/usr/bin/python
    # -*- coding: <encoding name> -*-
    songkaiape
    songkaiape
    Jan 6, 2016
    17
    @clino 看到这里忍不住笑了
    chenyuxiaodhr
    chenyuxiaodhr
    Jan 6, 2016
    18
    #/ w\ coding:utf8 / w\
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1308 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 66ms · UTC 21:01 · PVG 05:01 · LAX 13:01 · JFK 16:01
    ♥ Do have faith in what you're doing.