Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37356

Re: Converting a string to a number by using INT (no hash method)

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Converting a string to a number by using INT (no hash method)
Date 2013-01-22 17:22 -0500
Organization > Bestiaria Support Staff <
References <e74ae1aa-f760-4123-8770-3b8a4f9a2f91@googlegroups.com> <mailman.806.1358872054.2939.python-list@python.org> <4339f8d7-2d78-450f-ad0e-91da35615e6d@googlegroups.com> <mailman.812.1358875475.2939.python-list@python.org> <592233bd-3fc1-4e13-97f8-e11f89fbb0ba@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.842.1358893382.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, 22 Jan 2013 09:39:11 -0800 (PST), Ferrous Cranus
<nikos.gr33k@gmail.com> declaimed the following in
gmane.comp.python.general:


> 
> Finally!!!!!! THANK YOU VERY MUCH!!! THIS IS WHAT I WAS LOOKING FOR!!!
> 
> NOW, if you please explain it to me from the innermost parenthesis please, because i do want to understand it!!!
> 
> And since i'am sure it works, and i just used it on http://superhost.gr

	Really: Try running:

-=-=-=-=-=-=-
import os
import collections

PATH = "c:/windows"	#change this to your need

fids = os.listdir(PATH)

print "Number of files in directory %s: %s" % (PATH, len(fids))

cntr = collections.Counter()

for fid in fids:
    pin = int( fid.encode("hex"), 16 ) % 10000
    cntr.update([pin])

for pin, cnt in cntr.items():
    if cnt > 1:
        print "%10s %10s COLLISION" % (pin, cnt)


-=-=-=-=-=-
Number of files in directory c:/windows: 290
      9799          2 COLLISION
      7209          2 COLLISION
      8900          2 COLLISION
      6985          2 COLLISION
      1972          2 COLLISION
      2532          2 COLLISION
      3559          2 COLLISION

-=-=-=-=-=-
Number of files in directory e:/userdata/wulfraed/my documents/python
progs: 157
      1369          2 COLLISION
      6041          3 COLLISION
      3945          3 COLLISION
      8489          2 COLLISION
      7417          2 COLLISION
      9076          2 COLLISION
      6249          2 COLLISION
      2457          2 COLLISION
       937          2 COLLISION
      8249          2 COLLISION
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 08:15 -0800
  RE: Converting a string to a number by using INT  (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 16:27 +0000
    Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:02 -0800
      RE: Converting a string to a number by using INT  (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 17:24 +0000
        Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:39 -0800
          Re: Converting a string to a number by using INT (no hash method) John Gordon <gordon@panix.com> - 2013-01-22 18:36 +0000
          Re: Converting a string to a number by using INT  (no hash method) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 17:22 -0500
        Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:39 -0800
        Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:37 -0800
          Re: Converting a string to a number by using INT  (no hash method) Michael Torrie <torriem@gmail.com> - 2013-01-22 12:02 -0700
            Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 11:28 -0800
              Re: Converting a string to a number by using INT  (no hash method) Alan Spence <alan.spence@ntlworld.com> - 2013-01-22 20:00 +0000
            Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 11:28 -0800
              Re: Converting a string to a number by using INT (no hash method) John Gordon <gordon@panix.com> - 2013-01-22 20:40 +0000
                Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 00:44 -0800
          Re: Converting a string to a number by using INT  (no hash method) Dave Angel <d@davea.name> - 2013-01-22 14:08 -0500
          RE: Converting a string to a number by using INT  (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 20:30 +0000
          Re: Converting a string to a number by using INT  (no hash method) Dave Angel <d@davea.name> - 2013-01-22 15:43 -0500
        Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:37 -0800
    Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:02 -0800
  Re: Converting a string to a number by using INT  (no hash method) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-01-22 16:27 +0000
  Re: Converting a string to a number by using INT  (no hash method) Dave Angel <d@davea.name> - 2013-01-22 11:40 -0500
    Re: Converting a string to a number by using INT (no hash method) alex23 <wuwei23@gmail.com> - 2013-01-22 17:32 -0800
      Re: Converting a string to a number by using INT (no hash method) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 03:02 +0000
        Re: Converting a string to a number by using INT (no hash method) alex23 <wuwei23@gmail.com> - 2013-01-22 19:59 -0800
  Re: Converting a string to a number by using INT  (no hash method) "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-01-22 12:04 -0500

csiph-web