Daniel Mark wrote: > Question one: > Does python provide any function that can remove the last character of > a string? > I don't know whether or not the method I used is efficient
Doing fileName[-1] lets you access the last character, but I'm not sure about removing it since strings are immutable. It would still probably be something like you did. > Question two: > Does python provide any function that can remove the newline character > from a string if it exists? >>> fileName = 'Perfect Setup.txt\n' >>> fileName.strip() 'Perfect Setup.txt' >>> Or you can use lstrip() or rstrip() to remove just the left or right side. -- http://mail.python.org/mailman/listinfo/python-list