将 for 循环从 c# 翻译成 python (ironpython)
Translating a for loop from c# to python (ironpython)
我正在将我必须使用的一大块代码从 C# 翻译成 Python。
我不精通 C#。
你会如何翻译代码?:
Line foundLine = null;
for (int j = 0; null == foundLine && j < 2; j++)
{
do some stuff;
}
这将是上述 C#
代码的 python
翻译:
foundLine = None;
j = 0
while j < 2 and foundLine is None:
#do some stuff;
j += 1
我正在将我必须使用的一大块代码从 C# 翻译成 Python。 我不精通 C#。 你会如何翻译代码?:
Line foundLine = null;
for (int j = 0; null == foundLine && j < 2; j++)
{
do some stuff;
}
这将是上述 C#
代码的 python
翻译:
foundLine = None;
j = 0
while j < 2 and foundLine is None:
#do some stuff;
j += 1