f = open('歌词.txt',mode='r',encoding='utf-8') fText = f.read() f.close() print(fText)
If I got down on my knees And I pleaded with you If I cross a million oceans Just to be with you Would you ever let me down If I climbed the highest mountain Just to hold you tight If I said that I would loved you Every single night Well I'm sorry if it sounds kind of sad It's just that worried I'm so worried That you'll let me down Because I love you love you love you So don't you let me down If I swan the longest river Just to call your name If I said the way I fell for you Would never change Would you ever fool around Yes I'm so worried Yes I love you Don't you let me down I love you love you
f = open('geci.txt',mode='r',encoding='utf-8') fText = f.read() f.close() print(fText) replaceList = ['?','!',',','.'] for c in replaceList: fText = fText.replace(c,' ') print(fText) print(fText.split(' '))
If I got down on my knees And I pleaded with you If I cross a million oceans Just to be with you Would you ever let me down If I climbed the highest mountain Just to hold you tight If I said that I would loved you Every single night Well I'm sorry if it sounds kind of sad It's just that worried I'm so worried That you'll let me down Because I love you love you love you So don't you let me down If I swan the longest river Just to call your name If I said the way I fell for you Would never change Would you ever fool around Yes I'm so worried Yes I love you Don't you let me down I love you love you If I got down on my knees And I pleaded with you If I cross a million oceans Just to be with you Would you ever let me down If I climbed the highest mountain Just to hold you tight If I said that I would loved you Every single night Well I'm sorry if it sounds kind of sad It's just that worried I'm so worried That you'll let me down Because I love you love you love you So don't you let me down If I swan the longest river Just to call your name If I said the way I fell for you Would never change Would you ever fool around Yes I'm so worried Yes I love you Don't you let me down I love you love you ['\ufeffIf', 'I', 'got', 'down', 'on', 'my', 'knees\n', 'And', 'I', 'pleaded', 'with', 'you\n', 'If', 'I', 'cross', 'a', 'million', 'oceans\n', 'Just', 'to', 'be', 'with', 'you\n', 'Would', 'you', 'ever\n', 'let', 'me', 'down\n', 'If', 'I', 'climbed', 'the', 'highest', 'mountain\n', 'Just', 'to', 'hold', 'you', 'tight\n', 'If', 'I', 'said', 'that', 'I', 'would', 'loved', 'you\n', 'Every', 'single', 'night\n', 'Well', "I'm", 'sorry', 'if', 'it', 'sounds', 'kind', 'of', 'sad\n', "It's", 'just', 'that', 'worried\n', "I'm", 'so', 'worried\n', 'That', "you'll", 'let', 'me', 'down\n', 'Because', 'I', 'love', 'you\n', 'love', 'you', 'love', 'you\n', 'So', "don't", 'you', 'let', 'me', 'down\n', 'If', 'I', 'swan', 'the', 'longest', 'river\n', 'Just', 'to', 'call', 'your', 'name\n', 'If', 'I', 'said', 'the', 'way', 'I', 'fell', 'for', 'you\n', 'Would', 'never', 'change\n', 'Would', 'you', 'ever', 'fool', 'around\n', 'Yes', "I'm", 'so', 'worried\n', 'Yes', 'I', 'love', 'you\n', "Don't", 'you', 'let', 'me', 'down\n', 'I', 'love', 'you', 'love', 'you'] Process finished with exit code 0