I am trying to check if the first few characters within a string are certain numbers, and if they are, to substr those characters. So, I have tried
if files[1:4] == ("1990" or "1991")
substr(files, 0, 4)
While this is on the right track, it doesn't work because the syntax isn't right. All I want to do is check whether the first four characters of each string contains those particular characters and if so, substr those characters.
Any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire