ANN: New python software community website in Chinese, PythonNet.com

2007-01-28 Thread Wenshan Du
I've built a new website for python software community in Chinese: http://www.PythonNet.com Python is great for web programming. I use myghty as the main template, and some packages, such as SQLObject, MoinMoin, mod_python, etc. Example pages: * home: http://pythonnet.com/ *

Re: Do I need Python to run Blender correctly?

2007-01-28 Thread AKA gray asphalt
John Nagle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] AKA gray asphalt wrote: John Nagle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] AKA gray asphalt wrote: I downloaded Blender but there was no link for python. Am I on the right track? Blender doesn't

New Way to Search the Information - Ogleo.com - An Integrated Search

2007-01-28 Thread Shaine
We have just launched a new Search Tool - http://www.ogleo.com Kindly have a look and give us your suggestions here: Ogleo Discussion Forum http://forum.ogleo.com Links: == Ogleo Home Page - http://www.ogleo.com Ogleo Traffic Details - http://ogleo.com/traffic Ogleo Discussion Forums -

Re: set update in 2.5

2007-01-28 Thread Peter Otten
Duncan Smith wrote: In moving from 2.4 to 2.5 I find that some of my unit tests are now failing. I've worked out that the problem relates to the set update method. In 2.4 I could update a set with an iterable type derived from dict as the argument. I now find that the set is updated

Locking access to all data members

2007-01-28 Thread gooli
I have a class with a lot of attributes whose objects are accessed from multiple threads. I would like to synchronize the access to all the attributes, i.e. acquire a lock, return the value, release the lock (in a finally clause). Is there a way to do that without turning each attribute into a

Re: Crunchy 0.8 release

2007-01-28 Thread Steve Holden
André wrote: Version 0.8 of Crunchy has been released. It is available on http://code.google.com/p/crunchy/ Crunchy, the Interactive Python Tutorial Maker, is an application that transforms an ordinary html-based Python tutorial into an interactive session within a web browser. Currently,

Re: More Python screencasts (Google videos)

2007-01-28 Thread Steve Holden
[EMAIL PROTECTED] wrote: Here're three sample 3-6 min videos showing off Python to math teachers thinking about using a computer language instead of just calculators: http://controlroom.blogspot.com/2007/01/python-for-math-teachers.html Higher resolution versions are available to

Ip address

2007-01-28 Thread Scripter47
How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? #v+ python -c 'import re, urllib; print re.findall(titleYour IP: (.+?)/title,

Re: Mulig SPAM: Re: IP address

2007-01-28 Thread Scripter47
Klaus Alexander Seistrup skrev: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? #v+ python -c 'import re, urllib; print

from future module!!!!!!!

2007-01-28 Thread lee
Guys whats the from future module in python?thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Scripter47 wrote: python -c 'import re, urllib; print re.findall(titleYour IP: (.+?)/title, urllib.urlopen(http://myip.dk/;).read())[0]' Hmm then you need Internet connecting. That's what IP adresses are for... can i do it without that? Perhaps you could use the method mentioned in

Re: from future module!!!!!!!

2007-01-28 Thread Stargaming
lee schrieb: Guys whats the from future module in python?thanks http://docs.python.org/lib/module-future.html It's a module with that future changes may be activated (currently such as the with_statement, what isn't in the 2.5 standard so far). BTW, it's not the 'from future' module, it's

Re: Crunchy 0.8 release

2007-01-28 Thread André
I found it a little strange that the top-level directory in the distribution is called andre rather than crunchy, but that's a very minor point. Dang! Thanks for pointing this out; I've made the proper change. I had checked out from my development branch, as it contained the final

binary for osx needed

2007-01-28 Thread [EMAIL PROTECTED]
helo ppl! i wrote a small mp3 streaming server called csikk in python using basehttpserver. you can give it a try if you wish: http://code.google.com/p/csikk/ actually i need help in compiling an osx binary for my app, cause i don't own a mac. i wonder if anyone could help me. thanks in

Re: Ip address

2007-01-28 Thread Adam
Hey, This will get your IP address: ###Code print socket.gethostbyaddr(socket.gethostname()) ('compname', [], ['192.168.1.2']) End Code If you are wanting to to communicate over the internet you will have to get the IP of you rounter. So you will have to either find

Re: IP address

2007-01-28 Thread Colin J. Williams
Klaus Alexander Seistrup wrote: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? #v+ python -c 'import re, urllib; print

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Adam wrote: This will get your IP address: ###Code print socket.gethostbyaddr(socket.gethostname()) ('compname', [], ['192.168.1.2']) End Code It will return an IP address, but not necessarily the one you want: #v+ [EMAIL PROTECTED]:~ $ python -c 'import

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Colin J. Williams wrote: Your one-liner doesn't work for me, with Windows XP, but the following does, within Python. Could it be due to shell-escaping issues? I don't know anything about Windows... Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ --

Re: Locking access to all data members

2007-01-28 Thread Diez B. Roggisch
gooli schrieb: I have a class with a lot of attributes whose objects are accessed from multiple threads. I would like to synchronize the access to all the attributes, i.e. acquire a lock, return the value, release the lock (in a finally clause). Is there a way to do that without turning

Re: Ip address

2007-01-28 Thread Steve Holden
Adam wrote: Hey, This will get your IP address: ###Code print socket.gethostbyaddr(socket.gethostname()) ('compname', [], ['192.168.1.2']) End Code If you are wanting to to communicate over the internet you will have to get the IP of you rounter. So you

Re: Getting to an SSH account over a HTTP proxy

2007-01-28 Thread Nanjundi
problem. I do not want to create my own SSH client and, AFAICT, there is no SSH client in Twisted. The library also seem to have some problems with handling HTTP proxies in a transparent way:http://twistedmatrix.com/trac/ticket/1774 -- mvh Björn There is a ssh implementation in

Problems with ElementTree and ProcessingInstruction

2007-01-28 Thread Kent Tenney
Howdy, I want to generate the following file; ?xml version=1.0 encoding=utf-8? ?xml-stylesheet mystyle? leo_filestuff/leo_file How should I be doing this? As far as I can tell, ElementTree() requires everything to be inside the root element (leo_file) Thanks, Kent --

Re: Commandline wrapper: help needed

2007-01-28 Thread Toby A Inkster
Toby wrote: Any idea how to improve the script and solve this problem? Hello Toby, excellent name you have there. What advantage (if any) does this method have over standard UNIX-style pipes? -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact --

Re: Ip address

2007-01-28 Thread Toby A Inkster
Steve Holden wrote: There is absolutely no need to know the IP address of your router to communicate with Internet devices. Either your IP layer is configured to know the addresses of one or more routers, or it has discovered those address by dynamic means, or you can't get off-net because

Re: Ip address

2007-01-28 Thread Toby A Inkster
Scripter47 wrote: How do i get my ip address? Which IP address. One computer might have many IP addresses. (Indeed a typical network-connected computer will tend to have at least one for each connected network device, plus the special address 127.0.0.1 for the loopback network.) How is Python

Re: Commandline wrapper: help needed

2007-01-28 Thread Toby
Toby A Inkster wrote: Hello Toby, excellent name you have there. Why, thank you! What advantage (if any) does this method have over standard UNIX-style pipes? The advantage is being able to write my own filters and input/output modules and have as small a granularity as needed (while

howto redirect and extend help content ?

2007-01-28 Thread Stef Mientki
I'm making special versions of existing functions, and now I want the help-text of the newly created function to exists of 1. an extra line from my new function 2. all the help text from the old function # the old function def triang(M,sym=1): The M-point triangular window.== old help

Re: howto redirect and extend help content ?

2007-01-28 Thread karoly.kiripolszky
maybe you should make use of the objects' __doc__ attribute which holds the appropriate docstring. try to append something to it in the constructor. :) more on this in the manual: http://docs.python.org/tut/node11.html#SECTION001130 On Jan 28, 4:58 pm, Stef Mientki [EMAIL

Python interfacing with COM

2007-01-28 Thread Viewer T.
I am quite a newbie and I am trying to interface with Microsoft Word 2003 COM with Python. Please what is the name of the COM server for Microsoft Word 2003? -- http://mail.python.org/mailman/listinfo/python-list

Re: howto redirect and extend help content ?

2007-01-28 Thread Rob Wolfe
Stef Mientki [EMAIL PROTECTED] writes: I'm making special versions of existing functions, and now I want the help-text of the newly created function to exists of 1. an extra line from my new function 2. all the help text from the old function # the old function def triang(M,sym=1):

socket.inet_ntop, and pton question

2007-01-28 Thread Andrew
Hi Are these functions (inet_ntop(), inet_pton()) from the socket library supported on Windows. If not is there an equivalent for them using Windows Ive seen mention of people creating their own in order to use them Appreciate the help ty --

Re: howto redirect and extend help content ?

2007-01-28 Thread Stargaming
Stef Mientki schrieb: I'm making special versions of existing functions, and now I want the help-text of the newly created function to exists of 1. an extra line from my new function 2. all the help text from the old function # the old function def triang(M,sym=1): The M-point

string byte dump

2007-01-28 Thread Jammer
Does anyone that knows python want to write me a byte dump for strings? :-) I am trying to modify a plugin (that someone else wrote) that uses interprocess communication. It works on strings without special characters but it fails on other stings like Björk. It calls decode('utf8') but I guess

Re: string byte dump

2007-01-28 Thread Rob Wolfe
Jammer [EMAIL PROTECTED] writes: Does anyone that knows python want to write me a byte dump for strings? :-) I am trying to modify a plugin (that someone else wrote) that uses interprocess communication. It works on strings without special characters but it fails on other stings like Björk.

Re: socket.inet_ntop, and pton question

2007-01-28 Thread Irmen de Jong
Andrew wrote: Hi Are these functions (inet_ntop(), inet_pton()) from the socket library supported on Windows. If not is there an equivalent for them using Windows Ive seen mention of people creating their own in order to use them Appreciate the help ty Why didn't you just try:

Re: string byte dump

2007-01-28 Thread Jammer
Rob Wolfe wrote: Jammer [EMAIL PROTECTED] writes: Does anyone that knows python want to write me a byte dump for strings? :-) I am trying to modify a plugin (that someone else wrote) that uses interprocess communication. It works on strings without special characters but it fails on other

Re: howto redirect and extend help content ?

2007-01-28 Thread Stef Mientki
I'm making special versions of existing functions, and now I want the help-text of the newly created function to exists of snip Don't you think your users can follow this easy reference theirselves? My public consist of physicians with some knowledge of MatLab. I'm trying to give them a

Re: Do I need Python to run Blender correctly?

2007-01-28 Thread John Nagle
AKA gray asphalt wrote: John Nagle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is the manual you refer to the group project on blender.org or the $ manual like the one on Ebay? The Blender 2.3 Guide book. Also, if you're going to program the thing, the Blender GameKit

Trouble with max() and __cmp__()

2007-01-28 Thread Thomas Nelson
My code: class Policy(list): def __cmp__(self,other): return cmp(self.fitness,other.fitness) j = Policy() j.fitness = 3 k = Policy() k.fitness = 1 l = Policy() l.fitness = 5 print max([j,k,l]).fitness prints 3, when I was expecting it to print 5. What have I done wrong? Thanks for

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Jean-Paul Calderone
On 28 Jan 2007 12:46:07 -0800, Thomas Nelson [EMAIL PROTECTED] wrote: My code: class Policy(list): def __cmp__(self,other): return cmp(self.fitness,other.fitness) j = Policy() j.fitness = 3 k = Policy() k.fitness = 1 l = Policy() l.fitness = 5 print max([j,k,l]).fitness prints 3,

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Wojciech Muła
Thomas Nelson wrote: My code: class Policy(list): def __cmp__(self,other): return cmp(self.fitness,other.fitness) Define method __gt__. -- http://mail.python.org/mailman/listinfo/python-list

working model of a microcoded computer

2007-01-28 Thread kloro
This is somewhat off topic, but I think many programmers would be interested to look at a working model of a microcoded computer at: tomspages.com click on the link for 'Hack the Com puter Model.' It conveys among other things the physical events that underlie execution of a microcode

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Thomas Nelson
On Jan 28, 3:13 pm, Wojciech Muła [EMAIL PROTECTED] wrote: Define method __gt__. This works, thanks. I was a little surprised though. is __cmp__ used by any builtin functions? Thanks, THN -- http://mail.python.org/mailman/listinfo/python-list

Re: string byte dump

2007-01-28 Thread John Machin
On Jan 29, 4:57 am, Jammer [EMAIL PROTECTED] wrote: Does anyone that knows python want to write me a byte dump for strings? :-) I am trying to modify a plugin (that someone else wrote) that uses interprocess communication. It works on strings without special characters but it fails on other

Re: working model of a microcoded computer

2007-01-28 Thread Stef Mientki
kloro wrote: This is somewhat off topic, but I think many programmers would be interested to look at a working model of a microcoded computer at: tomspages.com click on the link for 'Hack the Com puter Model.' It conveys among other things the physical events that underlie

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Martin v. Löwis
Thomas Nelson schrieb: On Jan 28, 3:13 pm, Wojciech Muła [EMAIL PROTECTED] wrote: Define method __gt__. This works, thanks. I was a little surprised though. is __cmp__ used by any builtin functions? It is used by max() if the object doesn't implement __gt__. Regards, Martin --

Data structure and algorithms

2007-01-28 Thread azrael
Hy, i am a student and in 2 days I am writing a test in data structures and algorithms. I've done my homework and understood all the implementations and structures. My profesor was so kind to allow us to use any programing language we want, and I'd like to use pythhon. At the first look it

Re: Data structure and algorithms

2007-01-28 Thread azrael
I'm not a kid who heard that Python is simple, so he wants to use it and throw it away. I discovered it about 2 months ago, and I learnt it better then c in 2 years. I want to use python for this test because i love it. I am amazed about what i can do i such little time. My god, I even printed

Re: Data structure and algorithms

2007-01-28 Thread Jonathan Curran
What are you trying to make in the first place? A singly linked list? If so google is littered with examples of linked lists done in python. A simple search for 'python linked list' brings up many results. Btw, for future reference, no need for apologetics (the second post). - Jonathan --

Re: ftplib and retrbinary or retrlines (losing newline characters in my log files)

2007-01-28 Thread Gabriel Genellina
At Friday 26/1/2007 09:47, aus stuff wrote: Hi, im not sure if this is how i reply to the mail-list, excuse me if incorrect. Forwarding now to the list. Gabriels' solution works fine ftp.retrlines('RETR ' + fl, lambda line:fileObj.write('%s\n' % line)) But lambda's confuse me (newbie

Re: wxPython: panel not fully painted

2007-01-28 Thread citronelu
Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Data structure and algorithms

2007-01-28 Thread azrael
i'd like to get more control like in c with pointers. I want to loose the data after disabling: list=[] list.append(Node(1)) list.append(Node(2)) list[0].next=list[1] 1, 2 list.append(Node(3)) list[1].next=list[2] 1,2,3 list[0].next=list[2] 1,3 (but 2

Function to create Tkinter PhotoImages from directory?

2007-01-28 Thread Kevin Walzer
I am trying to create a number of Tk PhotoImages from a single directory. Currently I am hard-coding file names and image names, like so: def makeImages(self): self.imagedir = (os.getcwd() + '/images/') self.folder_new=PhotoImage(file=self.imagedir + 'folder_new.gif')

Re: Function to create Tkinter PhotoImages from directory?

2007-01-28 Thread James Stroud
Kevin Walzer wrote: I am trying to create a number of Tk PhotoImages from a single directory. Currently I am hard-coding file names and image names, like so: def makeImages(self): self.imagedir = (os.getcwd() + '/images/') self.folder_new=PhotoImage(file=self.imagedir +

Re: Function to create Tkinter PhotoImages from directory?

2007-01-28 Thread James Stroud
Kevin Walzer wrote: I am trying to create a number of Tk PhotoImages from a single directory. Currently I am hard-coding file names and image names, like so: def makeImages(self): self.imagedir = (os.getcwd() + '/images/') self.folder_new=PhotoImage(file=self.imagedir +

Re: memory leak

2007-01-28 Thread Gabriel Genellina
At Wednesday 24/1/2007 22:06, john g wrote: i have a memory leak issue with extension function that im working on. it reads data from a binary file into a stl vector then creates a new list to pass back to the python interface. the function works the first 1021 times but then gives a

Re: IP address

2007-01-28 Thread Gabriel Genellina
At Sunday 28/1/2007 10:28, Colin J. Williams wrote: Klaus Alexander Seistrup wrote: python -c 'import re, urllib; print re.findall(titleYour IP: (.+?)/title, urllib.urlopen(http://myip.dk/;).read())[0]' Your one-liner doesn't work for me, with Windows XP, but the following On XP you

Re: Problems with ElementTree and ProcessingInstruction

2007-01-28 Thread Gabriel Genellina
At Sunday 28/1/2007 11:28, Kent Tenney wrote: I want to generate the following file; ?xml version=1.0 encoding=utf-8? ?xml-stylesheet mystyle? leo_filestuff/leo_file How should I be doing this? open(filename,w).write('?xml version=1.0 encoding=utf-8?\n' '?xml-stylesheet mystyle?\n'

Re: Python interfacing with COM

2007-01-28 Thread Gabriel Genellina
At Sunday 28/1/2007 13:41, Viewer T. wrote: I am quite a newbie and I am trying to interface with Microsoft Word 2003 COM with Python. Please what is the name of the COM server for Microsoft Word 2003? Just use Word.Application, will launch the currently installed Word: py import

Re: socket.inet_ntop, and pton question

2007-01-28 Thread Gabriel Genellina
At Sunday 28/1/2007 15:17, Irmen de Jong wrote: Are these functions (inet_ntop(), inet_pton()) from the socket library supported on Windows. Why didn't you just try: [E:\Projects]python Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type help,

Re: problems with pyzeroconf and linux

2007-01-28 Thread Simo Hosio
On Sat, 27 Jan 2007, Damjan wrote: I am trying to get pyzeroconf (http://sourceforge.net/projects/pyzeroconf) running on my machine but having trouble... Running the Zeroconf.py file seems to register the service, but is unable to find it. You should be running avahi.. it also comes python

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Gabriel Genellina
At Sunday 28/1/2007 18:21, Thomas Nelson wrote: [EMAIL PROTECTED] wrote: Define method __gt__. This works, thanks. I was a little surprised though. is __cmp__ used by any builtin functions? The problem is, rich comparison functions take precedence over __cmp__, so if your base class (list

Re: Problems with ElementTree and ProcessingInstruction

2007-01-28 Thread Kent Tenney
On Jan 28, 7:46 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: At Sunday 28/1/2007 11:28, Kent Tenney wrote: I want to generate the following file; ?xml version=1.0 encoding=utf-8? ?xml-stylesheet mystyle? leo_filestuff/leo_file How should I be doing this?open(filename,w).write('?xml

Re: socket.inet_ntop, and pton question

2007-01-28 Thread Irmen de Jong
Gabriel Genellina wrote: But these are not the requested functions, inet_ntop() and inet_pton(): py socket.inet_ntop Traceback (most recent call last): File stdin, line 1, in ? AttributeError: 'module' object has no attribute 'inet_ntop' Oops, my bad. Should have had more coffee

Re: IP address

2007-01-28 Thread Garry Knight
Klaus Alexander Seistrup wrote: urllib.urlopen(http://myip.dk/;) http://whatismyip.org gives it to you in a more usable format. But, as others have pointed out, it might return your router's IP. -- Garry Knight [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting the output from a console command while it's been generated!

2007-01-28 Thread Raúl Gómez C.
I can't use the subprocess module because my app needs to be compatible with Python 2.3 so, is there another approach to this problem??? Thanks! On 1/26/07, Gabriel Genellina [EMAIL PROTECTED] wrote: Raúl Gómez C. [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I'm trying to

Re: IP address

2007-01-28 Thread Beej
On Jan 28, 2:26 am, Klaus Alexander Seistrup [EMAIL PROTECTED] wrote: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python??#v+

New internet services from MSN Yahoo! and Google are here

2007-01-28 Thread GFT
See our explain and compare about new service or feature from three search providers ; Windows Live (MSN) ,Yahoo! ,and Google. Learn more and get it today. At http://searchprovider.awardspace.com/ Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list

Convert from unicode chars to HTML entities

2007-01-28 Thread Steven D'Aprano
I have a string containing Latin-1 characters: s = u© and many more... I want to convert it to HTML entities: result = copy; and many more... Decimal/hex escapes would be acceptable: #169; and many more... #xA9; and many more... I can look up tables of HTML entities on the web (they're a dime

Re: Ip address

2007-01-28 Thread Adonis Vargas
Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? If you want to get your external IP you can do: import urllib checkIP =

Re: Do I need Python to run Blender correctly?

2007-01-28 Thread AKA gray asphalt
I think you're right. I'll find a blender forum. Thanks for your help. : -) John Nagle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] AKA gray asphalt wrote: John Nagle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is the manual you refer to the group project on

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Adonis Vargas
Steven D'Aprano wrote: I have a string containing Latin-1 characters: s = u© and many more... I want to convert it to HTML entities: result = copy; and many more... Decimal/hex escapes would be acceptable: #169; and many more... #xA9; and many more... I can look up tables of

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Adonis Vargas
Adonis Vargas wrote: [...] Its *very* ugly, but im pretty sure you can make it look prettier. import htmlentitydefs as entity s = u© and many more... t = for i in s: if ord(i) in entity.codepoint2name: name = entity.codepoint2name.get(ord(i)) entityCode =

sending a class as an argument

2007-01-28 Thread manstey
Hi, Our class has its attributes set as classes, as in MyClass.Phone.Value='34562346' MyClass.Phone.Private=True Inside the MyClass definition we have a function like this: def MyFunc(self,clsProperty): if clsProperty.Private: print 'Private property' else: print

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Gabriel Genellina
En Mon, 29 Jan 2007 00:05:24 -0300, Steven D'Aprano [EMAIL PROTECTED] escribió: I have a string containing Latin-1 characters: s = u© and many more... I want to convert it to HTML entities: result = copy; and many more... Module htmlentitydefs contains the tables you're looking for,

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Leif K-Brooks
Steven D'Aprano wrote: I have a string containing Latin-1 characters: s = u© and many more... I want to convert it to HTML entities: result = copy; and many more... Decimal/hex escapes would be acceptable: #169; and many more... #xA9; and many more... s = u© and many more...

Random passwords generation (Python vs Perl) =)

2007-01-28 Thread NoName
Perl: @char=(A..Z,a..z,0..9); do{print join(,@char[map{rand @char}(1..8)])}while(); !!generate passwords untill U press ctrl-z Python (from CookBook): from random import choice import string print ''.join([choice(string.letters+string.digits) for i in range(1,8)]) !!generate password once

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Leif K-Brooks
NoName wrote: from random import choice import string print ''.join([choice(string.letters+string.digits) for i in range(1,8)]) !!generate password once :( So add a while true: line. who can write this smaller or without 'import'? Why are those your goals? --

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Olexandr Melnyk
2007/1/29, Leif K-Brooks [EMAIL PROTECTED]: NoName wrote: from random import choice import string print ''.join([choice(string.letters+string.digits) for i in range(1,8)]) !!generate password once :( So add a while true: line. who can write this smaller or without 'import'? Being

Re: log parser design question

2007-01-28 Thread Paul McGuire
On Jan 27, 10:43 pm, avidfan [EMAIL PROTECTED] wrote: I need to parse a log file using python and I need some advice/wisdom on the best way to go about it: The log file entries will consist of something like this: ID=8688 IID=98889998 execute begin - 01.21.2007 status enabled locked

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2007 23:41:19 -0500, Leif K-Brooks wrote: s = u© and many more... s.encode('ascii', 'xmlcharrefreplace') '#169; and many more...' Wow. That's short and to the point. I like it. A few issues: (1) It doesn't seem to be reversible: '#169; and many

Re: Convert from unicode chars to HTML entities

2007-01-28 Thread Leif K-Brooks
Steven D'Aprano wrote: A few issues: (1) It doesn't seem to be reversible: '#169; and many more...'.decode('latin-1') u'#169; and many more...' What should I do instead? Unfortunately, there's nothing in the standard library that can do that, as far as I know. You'll have to write

Re: import from future

2007-01-28 Thread Dan Bishop
On Jan 28, 1:25 am, lee [EMAIL PROTECTED] wrote: what are the things that we can do with import from future usage.i heard its very interesting..thanks Now that nested_scopes and generators are no longer optional, the only thing left is from __future__ import division, which makes the /

Re: sending a class as an argument

2007-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2007 20:24:23 -0800, manstey wrote: Hi, Our class has its attributes set as classes, as in MyClass.Phone.Value='34562346' MyClass.Phone.Private=True The Python convention is that classes have initial capitals (MyClass), instances do not, and nor do attribute names. I'm

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Paul Rubin
NoName [EMAIL PROTECTED] writes: from random import choice import string print ''.join([choice(string.letters+string.digits) for i in range(1,8)]) !!generate password once :( who can write this smaller or without 'import'? If you don't mind possibly getting a few nonalphanumeric

decode overwrite variable?

2007-01-28 Thread Jammer
Will a failed decode overwrite the variable? message = message.decode('iso-8859-1') or do I need to do msg = message.decode('iso-8859-1') -- http://mail.python.org/mailman/listinfo/python-list

Re: decode overwrite variable?

2007-01-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Jammer wrote: Will a failed decode overwrite the variable? message = message.decode('iso-8859-1') or do I need to do msg = message.decode('iso-8859-1') Why don't you just try? In [2]: a = u'\u2022' In [3]: a = a.decode('iso-8859-1')

Re: import from future

2007-01-28 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Dan Bishop wrote: Now that nested_scopes and generators are no longer optional, the only thing left is from __future__ import division, which makes the / operator on integers give the same result as for floats. From 2.5 on we have `with_statement`::

Re: Data structure and algorithms

2007-01-28 Thread Terry Reedy
azrael [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Hy, i am a student and in 2 days I am writing a test in data | structures and algorithms. I've done my homework and understood all | the implementations and structures. My profesor was so kind to allow | us to use any programing

Re: Data structure and algorithms

2007-01-28 Thread Diez B. Roggisch
azrael schrieb: i'd like to get more control like in c with pointers. I want to loose the data after disabling: list=[] list.append(Node(1)) list.append(Node(2)) list[0].next=list[1] 1, 2 list.append(Node(3)) list[1].next=list[2] 1,2,3 list[0].next=list[2]

[ python-Bugs-1643738 ] Problem with signals in a single-threaded application

2007-01-28 Thread SourceForge.net
Bugs item #1643738, was opened at 2007-01-24 11:14 Message generated for change (Comment added) made by rhamphoryncus You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1643738group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1643738 ] Problem with signals in a single-threaded application

2007-01-28 Thread SourceForge.net
Bugs item #1643738, was opened at 2007-01-24 11:14 Message generated for change (Comment added) made by rhamphoryncus You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1643738group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1646630 ] ctypes.string_at(buf, 0) is seen as zero-terminated-string

2007-01-28 Thread SourceForge.net
Bugs item #1646630, was opened at 2007-01-28 22:18 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1646630group_id=5470 Please note that this message will contain a full copy of

[ python-Bugs-1646728 ] datetime.fromtimestamp fails with negative fractional times

2007-01-28 Thread SourceForge.net
Bugs item #1646728, was opened at 2007-01-29 10:21 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1646728group_id=5470 Please note that this message will contain a full copy of

[ python-Bugs-1646630 ] ctypes.string_at(buf, 0) is seen as zero-terminated-string

2007-01-28 Thread SourceForge.net
Bugs item #1646630, was opened at 2007-01-28 23:18 Message generated for change (Settings changed) made by theller You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1646630group_id=5470 Please note that this message will contain a full copy of the comment