<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://so.v2.cs.unibo.it/wiki/index.php?action=history&amp;feed=atom&amp;title=User%3APython</id>
	<title>User:Python - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://so.v2.cs.unibo.it/wiki/index.php?action=history&amp;feed=atom&amp;title=User%3APython"/>
	<link rel="alternate" type="text/html" href="https://so.v2.cs.unibo.it/wiki/index.php?title=User:Python&amp;action=history"/>
	<updated>2026-05-03T11:06:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://so.v2.cs.unibo.it/wiki/index.php?title=User:Python&amp;diff=413&amp;oldid=prev</id>
		<title>AlexJ: AlexJ moved page User:AlexJ to User:Python</title>
		<link rel="alternate" type="text/html" href="https://so.v2.cs.unibo.it/wiki/index.php?title=User:Python&amp;diff=413&amp;oldid=prev"/>
		<updated>2014-03-14T22:46:55Z</updated>

		<summary type="html">&lt;p&gt;AlexJ moved page &lt;a href=&quot;/wiki/index.php/User:AlexJ&quot; title=&quot;User:AlexJ&quot;&gt;User:AlexJ&lt;/a&gt; to &lt;a href=&quot;/wiki/index.php/User:Python&quot; title=&quot;User:Python&quot;&gt;User:Python&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:46, 14 March 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>AlexJ</name></author>
	</entry>
	<entry>
		<id>https://so.v2.cs.unibo.it/wiki/index.php?title=User:Python&amp;diff=300&amp;oldid=prev</id>
		<title>AlexJ: Created page with &quot; #ESERCIZIO 3 ESAME 20 GIUGNO 2013 #Scrivere un programma python o uno script bash per cercare all'interno #della directory corrente tutti i file che abbiano lo stesso contenu...&quot;</title>
		<link rel="alternate" type="text/html" href="https://so.v2.cs.unibo.it/wiki/index.php?title=User:Python&amp;diff=300&amp;oldid=prev"/>
		<updated>2013-11-23T15:53:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; #ESERCIZIO 3 ESAME 20 GIUGNO 2013 #Scrivere un programma python o uno script bash per cercare all&amp;#039;interno #della directory corrente tutti i file che abbiano lo stesso contenu...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
#ESERCIZIO 3 ESAME 20 GIUGNO 2013&lt;br /&gt;
#Scrivere un programma python o uno script bash per cercare all'interno&lt;br /&gt;
#della directory corrente tutti i file che abbiano lo stesso contenuto&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import os,sys&lt;br /&gt;
import filecmp&lt;br /&gt;
&lt;br /&gt;
def ordina(A,B):&lt;br /&gt;
    for i in range(0,len(B)) :&lt;br /&gt;
        for j in range(i,len(B)) :&lt;br /&gt;
            if(B[i]&amp;gt;B[j]) :&lt;br /&gt;
                A[i],A[j]=A[j],A[i]&lt;br /&gt;
                B[i],B[j]=B[j],B[i]&lt;br /&gt;
    return A,B&lt;br /&gt;
            &lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
def main() :&lt;br /&gt;
    A=[]&lt;br /&gt;
    B=[]&lt;br /&gt;
    l=[]&lt;br /&gt;
    H={}&lt;br /&gt;
    P=[]&lt;br /&gt;
    print os.getcwd()&lt;br /&gt;
    pa=os.getcwd()&lt;br /&gt;
    for root, dirs, files in os.walk(pa):&lt;br /&gt;
        if(root != pa):&lt;br /&gt;
            H[root]=0&lt;br /&gt;
    for root, dirs, files in os.walk(pa):&lt;br /&gt;
        if (root == pa) :&lt;br /&gt;
            for name in files :&lt;br /&gt;
                f = pa + '/' + name&lt;br /&gt;
                A = os.listdir(pa)&lt;br /&gt;
&lt;br /&gt;
    P = H.keys()&lt;br /&gt;
    for i in A :&lt;br /&gt;
        f = pa + '/' + i&lt;br /&gt;
        c = f in P&lt;br /&gt;
        if(c == 1) :&lt;br /&gt;
           A.remove(i)&lt;br /&gt;
    x=-1&lt;br /&gt;
    for root, dirs, files in os.walk(pa):&lt;br /&gt;
        if (root == pa) :&lt;br /&gt;
            for name in files :&lt;br /&gt;
                c = name in A&lt;br /&gt;
                if(c == 1) : &lt;br /&gt;
                    x=x+1&lt;br /&gt;
                    statinfo = os.stat(name)&lt;br /&gt;
                    B.insert(x,statinfo.st_size)&lt;br /&gt;
    print&lt;br /&gt;
    l=list()&lt;br /&gt;
    (A,B)=ordina(A,B)&lt;br /&gt;
    j=1&lt;br /&gt;
    c=0 &lt;br /&gt;
    z=0         &lt;br /&gt;
    for i in range(0,(len(A)-1)) :&lt;br /&gt;
        if(B[i] == B[j]) :&lt;br /&gt;
            F1 = open(A[i],'r')&lt;br /&gt;
            F2 = open(A[j],'r')&lt;br /&gt;
            if(filecmp.cmp(A[i], A[j])) :&lt;br /&gt;
                c=1&lt;br /&gt;
                if(z==0):&lt;br /&gt;
                    l.append(A[i])&lt;br /&gt;
                    z=1&lt;br /&gt;
                l.append(A[j])&lt;br /&gt;
            &lt;br /&gt;
        if (B[i] != B[j] and c==1):&lt;br /&gt;
            print &amp;quot;Questi file sono uguali di dimensione : &amp;quot;,B[i], &amp;quot;Byte&amp;quot;&lt;br /&gt;
            print l&lt;br /&gt;
            l=[]&lt;br /&gt;
            c=0&lt;br /&gt;
            z=0&lt;br /&gt;
            print&lt;br /&gt;
        j=j+1      &lt;br /&gt;
    if(c==1) :&lt;br /&gt;
        print &amp;quot;Questi file sono uguali di dimensione : &amp;quot;,B[i]&lt;br /&gt;
        print l      &lt;br /&gt;
    print&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot; :&lt;br /&gt;
    main()&lt;/div&gt;</summary>
		<author><name>AlexJ</name></author>
	</entry>
</feed>