import sys
string_input = "6\n212 132322\n212 21\n65 56\n32 3\n3232 32\n313 13\n0"
# a two dimensional array to store points
points = []
for line in string_input.split("\n"):
# split the inputed line using space to divide x and y coordinate
points_str = line.split(" ")
point_coordinate = []
if len(points_str) != 1:
for val in points_str:
point_coordinate.append(int(val))
points.append(point_coordinate)
print(str(points))
print(len(points_str))
왜 len (points_str)은 1을 반환합니까? 나는 1! = 1이 나머지 코드를 계속 수행하는 이유를 매우 혼란 스럽습니다.len (point_str)이 1을 반환하는 이유는 무엇입니까?
여기서 'points_str'값이 여러 개 있다는 것을 알고 계십니까? – user2357112
예, 길이가 1인지 확인하기 위해 인쇄물 (len (points_str))을 추가했습니다. – Laptic
이전 값 중 하나가 아닌'points_str'에 지정된 최종 값의 길이 만 인쇄합니다. – user2357112