当我运行此代码时,uniqe[0]
获取words
中的第一个字母
我想让它把整个单词放在uniqe[0]
里
我试过uniqe[0]=words[0]
,但不起作用
count = 0
for line in fhand:
words = line.split()
length = len(words)
print(words[0])
if count == 0:
uniqe=words[0]
print (uniqe)
print (uniqe[0])
输出
Enter the file name: romeo.txt
But
But
B
Tags:
我(仍然)不确定我是否理解你的问题,但这里有一个猜测:
输出:
相关问题 更多 >
编程相关推荐