Re: include a file in a python program
Thanks all for your response i will try out this week, you have give me sufficient hint. Thanks again. Bussiere On Mon, Sep 6, 2010 at 9:50 AM, Niklasro(.appspot) wrote: > On Sep 5, 10:57 pm, bussiere bussiere wrote: >> i've got a python.txt that contain python and it must stay as it (python.txt) >> >> how can i include it in my program ? >> import python.txt doesn't work >> is there a way : >> a) to make an include("python.txt") >> b) tell him to treat .txt as .py file that i can make an import python ? >> i'am using python3 >> Regards >> Bussiere >> fan of torchwood >> Google Fan boy > > You can do it with tkinter to also enable GUI. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
python and a 2 gigs Usb Stick (pure pythonic stick)
Hi, i've received for my birthday two usb key, and i had the idea to make the 2GB one a special python usb key. So far i've put on it : Movable Python My Python directory Iron Python Jython Instant django the file installation for : Python , iron python , jython , PIL , Pygame , Pywin32 The pdf in a doc_programmation : dive into python , programmting python What else should i add in this key in your opinion ? Regards and thanks -- http://mail.python.org/mailman/listinfo/python-list
speech recognition linux and python
just for my hobby, i'am looking in a way to try voice recongnition on linux with python but with google i didn't find anything probant. By the way does someones can give me some tips or url to digg in this way particulary ? Is there anyway to use python for voice recognition on linux ? If yes with what ? Regards bussiere "speech recognition linux and python" -- http://mail.python.org/mailman/listinfo/python-list
Re: deprecated python 2.5
thks Regards Bussiere On 9/12/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > bussiere maillist wrote: > > > DeprecationWarning: struct integer overflow masking is deprecated > > return struct.pack('>H', ~value) > > i didn't understand if someone have some explanation > > and what uses instead. > > the value doesn't fit in 16 bits. try masking off the extra bits on the > way in: > > struct.pack(" > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
deprecated python 2.5
DeprecationWarning: struct integer overflow masking is deprecated return struct.pack('>H', ~value) i didn't understand if someone have some explanation and what uses instead. -- http://mail.python.org/mailman/listinfo/python-list
convert a long string in binary
i've got a very long string and i wanted to convert it in binary like string = """Monty Python, or The Pythons, is the collective name of the creators of Monty Python's Flying Circus, a British television comedy sketch show that first aired on the BBC on October 5, 1969. A total of 45 episodes were made over four series. However, the Python phenomenon was much greater, spawning stage tours, a musical, four films, numerous albums, and several books, as well as launching the members to individual stardom. The television series, broadcast by the BBC from 1969 to 1974, was conceived, written and performed by Graham Chapman, John Cleese (1969-1973), Terry Gilliam, Eric Idle, Terry Jones and Michael Palin. Loosely structured as a sketch show, but with a highly innovative stream-of-consciousness approach (aided by Terry Gilliam's animations), it pushed the boundaries of what was then considered acceptable, both in terms of style and content. """ string = binary(string) print string // 01010101010101 i 'am searching for something like the binary function (taht doesn't exist) to convert my string directly in binary. Regards Bussiere -- http://mail.python.org/mailman/listinfo/python-list
making pseudo random number with spam ad convert text to binary
here is a little project to make a more or less good pseudo random generator by using spam :http://euryale.googlecode.com/it's almost quite finished but i've got a last problem i didn't manage to convert text to binary : hazard = binascii.a2b_qp(attachment) + binascii.a2b_qp(body) + binascii.a2b_qp(addr) + binascii.a2b_qp(sujet) print binascii.b2a_qp(hazard)it still print me ascii charactersregardsBussiere -- http://mail.python.org/mailman/listinfo/python-list
very strange bug coercing to Unicode: need string or buffer, int found
i truly didn't understand this error :Traceback (most recent call last): File "D:\Programmation\FrancePaquet\FrancePaquet.py", line 77, in ? cabtri = "zz" + chiffrescabtri + clefcTypeError: coercing to Unicode: need string or buffer, int found >>> if someone could help me i will be glad, this program worked yesterday.RegardsBussierehere is my program :import fileinput,stringdef calculclef(nombre): nombre2 = int(nombre)*10 nombre = str(nombre2) taille = len(nombre) compteur = 0 nombrepair = 0 nombreimpair = 0 compteur = taille - 2 while compteur != -1: print 'nombre :' print nombre[compteur] + '\n' if compteur%2 : nombrepair = nombrepair + int(nombre[compteur]) print 'suite pair %d' % nombrepair else: nombreimpair = nombreimpair + int(nombre[compteur]) print 'suite impair %d' % nombreimpair print compteur = compteur - 1 print nombreimpair print nombrepair clef = nombrepair*3+nombreimpair clef = 10-(clef%10) if clef == 10: clef = 0 return clefcompteclient = "8150"souscompteclient = "03"codeaffranc = "080"partielibre = "142391"print("LES CODES POSTAUX DOIVENT ETRE A LA FIN DU FICHIER CSV ! \n") fichA=raw_input("Entrez le nom du fichier d'entree : ")print ("\n")fichC=raw_input("Entrez le nom du fichier de sortie : ")print ("\n")debutplage = raw_input("Entrez le numero du debut de plage : ") print ("\n")finplage = raw_input("Entrez le numero de fin de plage : ")print ("\n") nbredeplage = int(debutplage) - int(finplage)fiA=open(fichA,"r") fiC=open(fichC,"w")print calculclef(debutplage)compteur = 0debutplagewhile 1: fileencoding = "latin1" ligneA=fiA.readline() ligneA = ligneA.decode(fileencoding) if ligneA == "": break if ligneA != "": stramettre = ligneA if compteur != 0: taille = len(ligneA) codepostal = ligneA[taille-5] + ligneA[taille-4] + ligneA[taille-3] + ligneA[taille-2]+ ligneA[taille-1] print codepostal clefb = calculclef(debutplage) clefb = str(clefb) print clefb num = str(debutplage) cabsuivis = "8w"+ num + clefb stramettre = stramettre + ";*" + cabsuivis + "*" chiffrescabtri = clefb + codepostal + compteclient + souscompteclient + codeaffranc + partielibre clefc = calculclef(chiffrescabtri) cabtri = "zz" + chiffrescabtri + clefc stramettre = stramettre + ";*" + cabtri + "*" fiC.write(stramettre) compteur += 1 print compteur, "\n"print "FINIT"fiA.close()fiC.close() -- http://mail.python.org/mailman/listinfo/python-list
gadfly error gadfly instance has no attribute 'execute'
here is the error i've get :Traceback (most recent call last): File "D:\Programmation\pitney\pitney.py", line 13, in ? connection.execute('create table personne(nom varchar)') AttributeError: gadfly instance has no attribute 'execute'i'am under windows and i still haven't found the errorhere is my code :import csv,gadfly,fileinput,glob, string, sys, os,unicodedata print "que voulez vous faire ?\n"fichA=raw_input("Entrez le nom du fichier a importer : ")cr = csv.reader(open(fichA),delimiter=";")connection = gadfly.gadfly()connection.startup ('pitney','D:\Programmation\pitney\')cursor = connection.cursor()connection.execute('create table personne(nom varchar)')cursor.execute("insert into personne(nom) values('bussiere')")connection.commit ()cursor.execute('select * from personne')print cursor.fetchall()compteur = 0for row in cr: print row[0],row[1]compteur += 1print "Dead Parrot"regards Bussiere -- http://mail.python.org/mailman/listinfo/python-list
python and QRcode ?
i'am looking for some module and programs in ptyhon for making qrcode (special kind of barcode)But i only found documentation and programs in japanese.Does it exist program and documentation for python in qrcode in english ? regardsBussiere -- http://mail.python.org/mailman/listinfo/python-list