Mistři v programování na #hovnokod

Python #396

from random import randint
import sys
import re


def recupIP():
    s = r"(%s)" % ("\.".join(['(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)']*4))
    patt = re.compile(s)
    fn = "ip.txt"
    s = open(fn).read()
    i = 0
    global permulist
    permulist = []
    global recuplist
    recuplist = []
    while True:
        m = patt.search(s, i)
        if m:
            recuplist.append(m.group(1))          
            i = m.end()+1
        else:
            break
    
#########convertir decimal au binaire###########

def decimalbinaire(string):
    quotient=int(string)
    liste=[]
    global res
    res=""
    
    if quotient==0:
        res="00000000"
    else:
        while quotient!=1:
            liste=liste+[quotient%2]
            quotient=quotient/2
        liste=liste+[1]
        while liste!=[]:
            res=res+str(liste[-1])
            liste=liste[:-1]
        if len(res)<8:
            octet=8-len(res)
            res='0'*octet + res
    return res
recupIP()

z = 0
binip,convert = [],[]
i=0
while i < len(recuplist):
	string = str(recuplist[i])
	string = string.split(".")
	while z < len(string):
		decimalbinaire(string[z])
		binip.append(res)
		z = z + 1
	binip="".join(binip)
        convert.append(binip)
        i=i+1

HovnoKod,