我正在尝试在我的 M1 Mac 上使用 SAM CLI。
\n我按照这些文档中概述的步骤进行操作:
\nsam init\ncd sam-app\nsam build\nsam deploy --guided\nRun Code Online (Sandbox Code Playgroud)\n我没有修改代码或 yaml 文件。\n我可以按预期启动本地 Lambda 函数:
\n\xe2\x9e\x9c sam-app sam local start-api\nMounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]\nYou can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically. If you used sam build before running local commands, you will need to re-run sam build for the changes …Run Code Online (Sandbox Code Playgroud) 我正在做一些实验,并且正在尝试这样做:
import math
for i in range(math.inf):
print(i)
Run Code Online (Sandbox Code Playgroud)
我希望它与此完全相同:
c = 0
while True:
print(c)
c += 1
Run Code Online (Sandbox Code Playgroud)
但它更像这样
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer
Run Code Online (Sandbox Code Playgroud)
然后,我尝试将转换inf为浮点数:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer
Run Code Online (Sandbox Code Playgroud)
但这给了我这个错误,表明您不能将float infinity转换为整数。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: cannot convert float infinity …Run Code Online (Sandbox Code Playgroud)