python list 1


####
file = open("f_fruits.txt", 'r')
content = file.readlines()
print(content)
for i in content:
    print(len(i.strip())) # list를 벗겨내기
file.close()
print("\n\n")
####
#####

file = open("fs_fruits.txt", 'r')
content = file.readlines()
print (content)
file.close()

print (type(content))
words = ''.join(content) # list를 문자열로
print (type(words))
print (content)

content_each = words.split(', ')
print(content_each)

file = open("fs_fruit_save.txt",'w')
for item in content_each:
    file.write(item+"\n")

file.close()


Python List 기본.
치매 예방용 1

댓글 없음:

댓글 쓰기