string - $在字符串中的含义?

标签 string svn character

我是这样过来的

__date__ = "$Date: 2011/06$"

并找到了这个 in the docs

  • $$ is an escape; it is replaced with a single $.
  • $identifier names a substitution placeholder matching a mapping key of "identifier". By default, "identifier" must spell a Python identifier. The first non-identifier character after the $ character terminates this placeholder specification.
  • ${identifier} is equivalent to $identifier. It is required when valid identifier characters follow the placeholder but are not part of the placeholder, such as "${noun}ification".

但是我不明白。

谁能用通俗易懂的英语解释一下 $ 的作用并最好给出一些例子?

最佳答案

对于 Python 来说,那些美元符号毫无意义。就像后面的 'D''a' 一样,美元符号只是字符串中的一个字符。

对于您的源代码控制系统,美元符号表示替换命令。当您 checkout 源代码的新副本时,该字符串将替换为上次提交的文件更改的时间戳。

引用:

关于string - $在字符串中的含义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22669859/

相关文章:

Java swt 改变键入的字符

string - 后缀数组实现错误

c - 存储文本文件中的每个字符

javascript - 确认匹配的结束 boolean 问题 (JavaScript)

svn - 将未版本化的目录结构合并到 SVN 存储库中

svn - 我可以在不执行合并的情况下从主干更新分支吗?

android - 如何获取 Android 中菜单项的 Android ID?

SVN 一次性备份所有仓库

c - 如何修改C中字符串数组中的单个字符?

java - FOR 循环中的 StringIndexOutOfBoundsException