제 문제는 파이썬이 원시 입력을 먼저 읽은 후에 더 이상 입력을 올바르게 읽지 않는다는 것입니다. 나는 많은 것을 시도했지만 그것을 얻을 수없는 것 같습니다. 내가 도대체 뭘 잘못하고있는 겁니까?파이썬 입력이 잘못 읽습니까?
file_path = 'C:\\Users\\Neo\\My Documents\\Python Scripts\\FTC Scouting\\sample.txt'
file = open(file_path, 'r')
Team_Numbers = []
tNum = 'Team Number: '
tName = 'Name: '
ui = ''
def list_teams(n):
count = 0
if n == '1':
for line in file:
check = line.find(tNum)
if not check == -1:
print line[len(tNum):] #prints everything after the Team Number:
count += 1
elif n == 2:
for line in file:
check = line.find(tName)
if not check == -1:
print line[len(tName):] #prints everything after the Team Number:
count += 1
while not ui == 'end':
ui = raw_input('1: to list Team Numbers\n2: to list Names\n')
list_teams(ui)
file.close()
무엇이'count' 변수입니까? –