gpt4 book ai didi

python - 将版权符号放入 Python 文件

转载 作者:太空狗 更新时间:2023-10-29 17:21:23 24 4
gpt4 key购买 nike

我需要在我制作的每个 Python 源文件的顶部包含版权声明:

#   Copyright: © 2008 etc.

但是,当我运行这样的文件时,我收到了这条消息:

SyntaxError: 文件 MyFile.py 中第 3 行的非 ASCII 字符 '\xa9',但未声明编码;见http://www.python.org/peps/pep-0263.html了解详情。

显然 Python 对版权符号不满意,因为它假定源文件全部采用 ASCII 格式。要么我需要让我的第一行是:

# -*- coding: iso-8859-1 -*-

告诉 Python 我正在使用拉丁编码,或者我可以将版权声明更改为:

#   Copyright: \xa9 2008 etc.

这可能不具有相同的法律地位。

有没有更优雅的解决方案?

最佳答案

ASCII 中的版权符号拼写为 (c) 或“Copyright”。

参见61号文Copyright Registration for Computer Programs .

虽然法律形式主义(见通告 1,Copyright Basics)确实是

The symbol © (the letter C in a circle), or the word “Copyright,” or the abbreviation “Copr.”; and...

这也是事实

To guarantee protection for a copyrighted work in all UCC member countries, the notice must consist of the symbol © (the word “Copyright” or the abbreviation is not acceptable)

通告3可以深挖和 38a .

然而,这已经在法庭上进行了测试。这不是一个有趣的问题。如果您搜索“(c) acceptable for c-in-a-circle”,您会发现律师都同意 (c) 是可接受的替代。参见 Perle 和 Williams。请参阅 Scott 的信息技术法。

关于python - 将版权符号放入 Python 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/221376/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com