View Single Post
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#6
Originally Posted by khuong View Post
Thank you very much

Will this be correct?

newstr = str[:strlen]
Yes, that works. Just make sure that when you define str, it gets defined as a string instead of an integer.

For instance, typing "str = 123456789" in python will give you the integer 123456789 (one hundred twenty-three million, four hundred fifty-six thousand, seven hundred eighty nine), instead of the characters "123456789".

By the same token, make sure strlen is defined as an integer. If it gets interpreted as a string, prob'ly won't work.

Also, if this is N900 python development, you can just type "python" in the X-Terminal to get an interactive python shell from which you can test all this stuff.
 

The Following User Says Thank You to Mentalist Traceur For This Useful Post: