【问题标题】:Is there any command to make the math symbol "not equal" appear in a string?是否有任何命令可以使数学符号“不等于”出现在字符串中?
【发布时间】:2022-06-19 08:16:15
【问题描述】:

例如,打印希腊字母 alpha 我使用了\u03B1,输出为:

α

现在我想像这样打印不相等:

【问题讨论】:

  • 查找符号的 Unicode 代码
  • 你可以写print("3 ≠ 5")
  • 如果您可以在代码编辑器中键入或粘贴“≠”,那么您无需执行 mkrieger1 所说的任何操作,但仅供参考:\u03B1 是 Python 语法,它指定了 unicode 代码点 仅使用 ASCII 字符。如果您在 Google 上搜索“unicode lower case alpha”,您首先会看到同一事物的官方 Unicode 表示“U+03B1”。现在谷歌搜索“unicode not equal sign”,你应该能够弄清楚下一步该做什么。要了解更多信息,请参阅docs.python.org/3/howto/unicode.html

标签: python string math printing ironpython


【解决方案1】:

您可以执行以下操作:

print(u'\u2260')

【讨论】:

    【解决方案2】:
    u"\u2260"
    

    来源https://www.fileformat.info/info/unicode/char/2260/index.htm

    您可以通过谷歌搜索获得大多数 UTF 编码:)

    【讨论】:

      猜你喜欢
      • 2020-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-28
      • 1970-01-01
      • 2010-10-25
      • 1970-01-01
      • 2019-12-30
      相关资源
      最近更新 更多