python truncate a long string

Posted by Hulk on Stack Overflow See other posts from Stack Overflow or by Hulk
Published on 2010-05-20T09:37:03Z Indexed on 2010/05/20 9:40 UTC
Read the original article Hit count: 173

Filed under:
|

How to truncate sthe string to 75 characters only in python

This is how it was done in javascript

              var data="saddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddsaddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddsadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
               var info = (data.length > 75) ? data.substring[0,75] + '..' : data;

© Stack Overflow or respective owner

Related posts about python

Related posts about pythonic