[Python] 띄어쓰기 없이 입력되는 2차원 행렬을 2차원 배열로 입력 받는 방법 ☑️
·
Python
파이썬에서 string.split("") 호출 시ValueError: empty separator 오류 발생따라서 리스트로 변환 후 반복문으로 원소 하나씩 꺼내는 방법 사용 import sysn, m = map(int, sys.stdin.readline().split())# n은 행(row), m은 열(column)graph = []for i in range(n): a = list(sys.stdin.readline().rstrip()); b = [] for x in a: b.append(int(x)) graph.append(b) strip()양쪽(왼쪽 + 오른쪽) 공백 또는 지정한 문자를 제거 text = " Hello, Python! "result = text.strip..