Re: [Tutor] String module; Count

2007-10-22 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > think), but since I'm new to this thing, I thought I'd do the safe > thing and > try a second time. I personally didn't see the earlier one so can't say if it got here or not. But I'll throw in some comments below. But first I will say that you seem to be going out

Re: [Tutor] String module; Count

2007-10-21 Thread ddm2
Hi, Not sure if this is necessary, as I sent another email to the list (I think), but since I'm new to this thing, I thought I'd do the safe thing and try a second time. The code almost works now. Although, as soon as the converter gets a number -8 or lower, it adds a 0 that is not necessary. CO

Re: [Tutor] String module; Count

2007-10-17 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > I am having trouble getting the string.count function to work. I want it to > count the amount of digits (0 or 1) in the string, but I keep getting an > error stating the string.count was expecting a character buffer object. > CODE: > count = string.count(conversion(n),["

Re: [Tutor] String module; Count

2007-10-17 Thread Ben Sherman
You can only count one at a time. count = conversion(n).count("0") + conversion(n).count("1") count is a string method, so it operates directly on the string - you don't have to call it like you did. import string string.count(mystr, "cheese") is the same as mystr.count("cheese") At least it

[Tutor] String module; Count

2007-10-17 Thread ddm2
I am having trouble getting the string.count function to work. I want it to count the amount of digits (0 or 1) in the string, but I keep getting an error stating the string.count was expecting a character buffer object. CODE: count = string.count(conversion(n),["0","1"]) ERROR: Traceback (most re