So I need to write a function that if a file exists, it will change the file name by sequentially adding integers, starting with 1, to the base file name (the part that does not include the file extension). so if the filename is hello.dat, then it will return hello1.dat and if it exists, then hello2.dat, and so on. If it does not exist it'll stop.
I understand that I have to use a while loop and os.path.isfile. My teacher suggested rsplit and I don't understand it. I've googled it, and read many sites, and it's so unclear to me! it says something about sep, maxsplit, delimiter? I don't understand.