How many bytes long is a string?
Tim Peters
tim_one at email.msn.com
Mon Aug 7 23:50:38 EDT 2000
More information about the Python-list mailing list
Mon Aug 7 23:50:38 EDT 2000
- Previous message (by thread): How many bytes long is a string?
- Next message (by thread): How many bytes long is a string?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Thomas Gagne] > Hmm. I need to know how many bytes a String is going to be. Given > > s = "Now is the time" len(s); string is a sequence type; len is a polymorphic builtin that can be applied to all sequence types; note that len(string) actually returns the number of characters, not the number "of bytes"; that becomes a more important distinction in 1.6 with the introduction of Unicode strings. > ... > I would prefer to stick with objectname.methodname() but the obvious > ones aren't working. None of the builtin sequence types support a method to get their length; invest a little time studying the "builtin functions" section of the Library Reference Manual before you go looking for other methods that don't exist <wink>.
- Previous message (by thread): How many bytes long is a string?
- Next message (by thread): How many bytes long is a string?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list