대부분의 코드가 수정되었지만 내가 가지고있는 유일한 문제는 텍스트가 표시되지 않는다는 것입니다. 나는 골퍼 이름과 점수를 입력해야하지만 프로그램을 실행할 때 아무 것도 나타나지 않습니다.내 코드를 실행해도 아무 것도 보이지 않습니다.
def main():
inGolf = open('golfers.txt', 'r')
names = []
scores = []
for line in inGolf:
line_list = line.split(",")
names.append(line_list[0])
scores.append(line_list[1])
for i in range(len(names)):
print ("{0:20}{1:10}".format(names[i], scores[i]))
inGolf.close()
def w(numPlayers):
counter = 0
outGolf = open('playerData.txt', 'w')
while counter < numPlayers:
name = raw_input("Please enter the player's name:")
outGolf.write(name + ",")
score = input("Please enter that player's score:")
outGolf.write(str(score) + "\n")
counter = counter + 1
outGolf.close()
main()
당신이 전화하지가 전체의 기능이있다, 어쩌면 조사를? – jonrsharpe
'main()'의 첫 번째'for' 루프를 입력했는지 확인하기 위해 인쇄 문구를 추가하십시오. – mitoRibo
그리고 그 동안 파일 이름이 다른 이유를 알아낼 수 있습니까? –