我想在 python 中输入注释一个只接受单个字符的函数,例如:\n(s: str) -> int
由于 Python 没有单个字符的类型,因此您不能只执行类似(s: char) -> int.
有没有一种方法可以让键入的内容s: str只能是一个字符?
我发现这对于编写代码时的提示很有用。
\n这是我的完整示例:
\nimport unicodedata\n\nroman_numeral_lookup = {"I": 1, "V": 5, "X": 10, ...}\n\ndef exact_roman_numeral(s: str) -> int:\n """Return the value of a single Roman numeral. Dosen\'t support multicharacter roman numerals such as \'XII\' or Apostrophus."""\n\n # Convert Unicode Roman numerals into to their normalised text version. e.g. \xe2\x85\xa9 -> X, \xe2\x85\xb0 -> I\n s = unicodedata.normalize("NFKC", s).upper()\n\n …Run Code Online (Sandbox Code Playgroud) 我是 Lua 新手,需要知道如何在 Windows 上安装它?
我已经尝试过,但无法运行该示例。当我尝试编译它时显示 100% 成功,但是当我单击运行按钮时,它显示此错误:
Can't find moai executable in any of the folders in PATH or MOAI_BIN:
C:\Program Files\moai, D:\Program Files\moai, C:\Program Files (x86)\moai, D:\Program Files (x86)\moai, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\moai-sdk\bin\win32\moai.exe, C:\moai-sdk/bin
Run Code Online (Sandbox Code Playgroud)
如果有人可以帮助我安装Lua,谢谢。