-2
好吧,所以我開始在我的類中學習python,但我非常惱火如何不能像其他語言一樣在python中聲明變量類型。將這些字符串轉換爲整數的最佳方法是什麼?Python中,如何從字符串中使這些變量整數
for lineNum, line in enumerate(sys.stdin):
if(lineNum == 0):
xc, yc = eval(line)
xc = int(xc)
yc = int(yc)
elif(lineNum == 1):
r = line
r = int(r)
elif(lineNum == 2):
x1, y1 = eval(line)
x1 = int(x1)
y1 = int(y1)
else:
x2, y2 = eval(line)
x2 = int(x2)
y2 = int(y2)
use'int(string_value)'' – kogito