"Akash" <[EMAIL PROTECTED]> wrote >> How do I make Python read a string character by character? > >>>> str = 'string' >>>> for i in range(0, len(str)): > ... print str[i] > ...
Or without indexing: for c in "string": print c > s > t > r > i > n > g However I'm not sure if thats what Nathan meant. If you mean how do you read a string of characters from a file use read() with a size of 1. If you mean from stdin then it depends on the platform. Use curses for Linux/MacOS or use msvcrt. In both cases the function is getch() Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor