列表的最后一个元素在python中被截断了?

时间:2018-06-03 14:02:20

标签: python list elements

!curlhttps://raw.githubusercontent.com/MicrosoftLearning/intropython/master/elements1_20.txt -o elements1_20.txt
elements = open('elements1_20.txt', 'r')
elements_lines = elements.readlines()

count = 0

for line in elements_lines:
    elements_lines[count] = line[:-1].lower()
    count += 1

print(elements_lines)

['hydrogen', 'helium', 'lithium', 'beryllium', 'boron', 'carbon', 'nitrogen', 'oxygen', 'fluorine', 'neon', 'sodium', 'magnesium', 'aluminum', 'silicon', 'phosphorus', 'sulfur', 'chlorine', 'argon', 'potassium', 'calciu']

正如您所看到的,列表的最后一个元素未完全显示?可以有人帮助我这样做。

0 个答案:

没有答案