0
이름 만 인쇄 할 수는 없습니다.python은 텍스트 파일의 이름 만 인쇄합니다.
http://www.ics.uci.edu/~kay/malenames.txt
from collections import namedtuple
FN = namedtuple('FN','name percent people rank')
FirstN = namedtuple('FirstN','FN')
def firstname()->str:
'''returns a firstname from text file'''
filein = open('malenames.txt','r')
for str in filein:
s = str.split('\t')
print (s)
FN1 = FN(s)
F1 = FirstN(FN1)
for name in F1:
print(name)
firstname()
, 편집
이것은 내가 지금까지
여기가 malenames.txt에 대한 링크입니다 가지고 무엇인가 . –
감사합니다 지금 작동합니다. –