[snip] Why would you use line.__str__() instead of str(line) ? [/snip] Mostly because I'm a Python Noob, and dir(line) reminded me about its __str__() method. And I did note that this wasn't the best way to do it, just that it'd work. Now I know about str(line) though, so thanks!
On Fri, Mar 12, 2010 at 4:46 PM, Ethan Furman <[email protected]> wrote: > Ryan Arana wrote: > > [snip] > > > On second thought though, the easiest (read: the quickest, and >> not necessarily the best) way to make this work (if print data4 works the >> way I think it does anyway) would be to just change "line" to >> "line.__str__()" in the line.replace line of code. So it will read >> "line.__str__().replace('[', ' ').replace(']', ' '). >> > > Why would you use line.__str__() instead of str(line) ? For that matter, > instead of using replace, the OP could do > > str(line)[1:-1] > > to chop off the beginning and ending brackets. > > ~Ethan~ > > _______________________________________________ > Portland mailing list > [email protected] > http://mail.python.org/mailman/listinfo/portland > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/portland/attachments/20100313/7c423f64/attachment.html> _______________________________________________ Portland mailing list [email protected] http://mail.python.org/mailman/listinfo/portland
