<div dir="ltr"><div>Thanks, I cannot utilize the String Class completely. I'm a newbie for python<br><br></div>
<div class="gmail_quote">2008/8/18 Gabriel Genellina <span dir="ltr"><<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">En Sun, 17 Aug 2008 21:57:46 -0300, Patrol Sun <<a href="mailto:sunp1028@gmail.com">sunp1028@gmail.com</a>> escribió:<br>

<div class="Ih2E3d"><br>> Of course We needn't 100 levels,but I use the exec function can concise the<br>> code. See the attachment.<br><br></div>Just a note on the attached code:<br><br>def isPro52Num(n):<br>       s=[]<br>
       for i in range(1,7):<br>               s.append(str(i*n))<br>       for i in s[0]:<br>               ll = len(string.join(string.split(s[0],i),''))<br>               for j in range(1,6):<br>                       if ll!=len(string.join(string.split(s[j],i),'')):<br>
                               return False<br>       return True<br><br>The functions in the string module have been deprecated ages ago in favor of the corresponding string methods.<br>In this expression: len(string.join(string.split(s[0],i),'')) if you want to get "the number of digits in s[0] that are not i" I think it's way faster (and more clear) to do len(s[0])-s[0].count(i) instead of creating two lists just to throw them away.<br>
<br>--<br><font color="#888888">Gabriel Genellina<br></font>
<div>
<div></div>
<div class="Wj3C7c"><br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br></div></div></blockquote></div><br></div>