我想在Python中编写一个函数,它根据输入索引的值返回不同的固定值.
在其他语言中,我会使用switch或case声明,但Python似乎没有switch声明.在这种情况下,推荐的Python解决方案是什么?
我试图了解代码中的确切位置GOTO :EOF返回?
这是代码:
SET count=1
FOR /f "tokens=*" %%G IN (somefile.txt) DO (call :subroutine "%%G")
GOTO :EOF
:subroutine
echo %count%:%1
set /a count+=1
GOTO :EOF
Run Code Online (Sandbox Code Playgroud) 我理解代码中的标签链接,但有什么区别?
@echo off
:top
echo I love StackOverflow.com
goto :top
Run Code Online (Sandbox Code Playgroud)
@echo off
:top
echo I love StackOverflow.com
call :top
Run Code Online (Sandbox Code Playgroud)
先感谢您!