0
爲什麼下面的代碼1工作而code2不工作?爲什麼一件事情有效,另一件事卻不行?
代碼1:
#Read from a file
readMe = open('WriteToFile.txt', 'r').read()
print(readMe)
splitMe = readMe.split('\n')
print(splitMe)
代碼2:
#Read from a file
readMe = open('WriteToFile.txt', 'r')
print(readMe.read())
splitMe = readMe.read().split('\n')
print(splitMe)