小编Goo*_*ver的帖子

如何输入注释字符串的长度?

我想在 python 中输入注释一个只​​接受单个字符的函数,例如:\n(s: str) -> int

\n

由于 Python 没有单个字符的类型,因此您不能只执行类似(s: char) -> int.

\n

有没有一种方法可以让键入的内容s: str只能是一个字符?

\n

我发现这对于编写代码时的提示很有用。

\n

这是我的完整示例:

\n
import 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)

python python-3.x

9
推荐指数
1
解决办法
3319
查看次数

如何在 Windows 上安装 Lua

我是 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,谢谢。

installation lua

5
推荐指数
1
解决办法
5020
查看次数

标签 统计

installation ×1

lua ×1

python ×1

python-3.x ×1