Nov-12-2019, 10:42 AM
im new to python and im trying to split a string so it prints the first letter of each word.
Below is the error i keep getting
line 8, in split_song
for letter in songnames.split(" "):
AttributeError: 'function' object has no attribute 'split'
Below is the error i keep getting
line 8, in split_song
for letter in songnames.split(" "):
AttributeError: 'function' object has no attribute 'split'
def access_data(): with open("Songnames.txt", "r") as f: songnames = [line.strip("\n") for line in f] def split_song(songnames): for letter in songnames.split(" "): print(letter[0]) songnames = access_data split_song(songnames)