Documentation for iteration in mappings

2005-10-25 Thread Dennis Benzinger
Hi! I must be blind because I didn't find anything in the documentation which says iterating over an dictionary iterates over its keys. For example a_dictionary = {0: "zero", 1: "one"} for x in a: print x gives you 0 1 Where is this information hidden? :) Bye, Dennis -- http://mail.py

Re: Math markup in code documentation?

2005-10-25 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > Done any one have a way (and examples) of how to do math markups in the > docstrings of function and class definitions such that the equations > get typeset in the generated html documentation? I'll take any markup > system that'll do the job... MathML or LaTeX possibl

Re: any python module to calculate sin, cos, arctan?

2005-11-08 Thread Dennis Benzinger
Shi Mu schrieb: > any python module to calculate sin, cos, arctan? Yes. Use the math module or the cmath module if you need mathematical functions for complex numbers. Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-list

Re: parse data

2005-11-09 Thread Dennis Benzinger
py schrieb: > I have some data (in a string) such as > > person number 1 > > Name: bob > Age: 50 > > > person number 2 > > Name: jim > Age: 39 > > ...all that is stored in a string. I need to pull out the names of the > different people and put them in a list or something. Any > suggest

Re: path module / class

2005-11-16 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > [...] > What is the status of the path module/class PEP? Did somebody start > writing one, or did it die? I didn't find one at the PEP index , so I assume that nobody wrote or submitted one. > I would really like to see something like > Ja

Re: searching for files on Windows with Python

2005-11-17 Thread Dennis Benzinger
Shane schrieb: > I've been giving Google a good workout with no luck. I would like to be able > to search a Windows filesystem for filenames, returning a list off absolute > paths to the found files, something like: > > def findFiles(filename, pathToSearch): > ... > ... > return f

Re: the first element in the list of list

2005-11-22 Thread Dennis Benzinger
Ben Bush schrieb: > I have a lis: > [[1,3],[3,4],[5,6],[8,9],[14,0],[15,8]] > I want a code to test when the difference between the first element in > the list of list is equal to or larger than 6, then move the previous > lists to the end of the list. that is: > [[14,0],[15,8],[1,3],[3,4],[5,6],[8

Re: XMLSchema Parsing

2005-11-29 Thread Dennis Benzinger
km schrieb: > Hi all, > i'd like to know if there are any good XMLSchema (.xsd files) parsing modules > in python. > regards, > KM > Try lxml a pythonic binding for the libxml2 and libxslt libraries. Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-

Re: newbie question concerning formatted output

2005-11-29 Thread Dennis Benzinger
Thomas Liesner schrieb: > [...] > i am having some hard time to format the output of my small script. I am > opening a file which containes just a very long string of hexdata > seperated by spaces. Using split() i can split this string into single > words and print them on stdout. So far so good. B

Python web publishing framework like Cocoon?

2005-12-07 Thread Dennis Benzinger
Hi! Is there a Python web publishing framework like Cocoon? I found Maki but it was last updated in 2003 and its author says that he doesn't want to make another release... Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-list

Re: Open Folder in Desktop

2005-01-25 Thread Dennis Benzinger
Kamilche wrote: > Is there a command you can execute in Python that will open a window on > the desktop, such as 'My Documents'? Kind of like 'system', but for > folder names, not just programs. I'm running on Windows 2000. > Here are some commands you can use (tested on WinXP, so YMMV): 1. The

Re: module for 'po' files

2005-01-25 Thread Dennis Benzinger
Sara Fwd wrote: > Hi all > Is there a module for processing & handling '.po' > files in python? > [...] I don't know if there is a module for processing them, but Python comes with msgfmt.py (in Tools/i18n) which creates .mo files out of your .po files. So read the source and see if there's som

Re: string.atoi and string.atol broken?

2005-01-25 Thread Dennis Benzinger
Mike Moum wrote: > I think there may be a bug in string.atoi and string.atol. Here's some > output from idle. > > >>Python 2.3.4 (#2, Jan 5 2005, 08:24:51) >>[GCC 3.3.5 (Debian 1:3.3.5-5)] on linux2 >>Type "copyright", "credits" or "license()" for more information. >> >>**

Re: String Fomat Conversion

2005-01-27 Thread Dennis Benzinger
mcg wrote: > Investigating python day 1: > > Data in file: > x y > 1 2 > 3 4 > 5 6 > > > Want to read file into an array of pairs. > > in c: scanf("%d %d",&x,&y)---store x y in array, loop. > > How do I do this in python?? > In the actual application, the pairs are floating pt i.e. -1.

Re: MySQLdb - Tuples

2005-02-01 Thread Dennis Benzinger
Lajos Kuljo wrote: > Hallo, > ich bin voll neu im Python-Programming, deshalb ist mein Problem > wahrscheinlich trivial: > > Wenn ich die Script > #33 > #! /usr/bin/env python > import MySQLdb > db=MySQLdb.connect(host='localhost', db='photum_0_6_2', user='

Re: command line argument passing

2005-07-22 Thread Dennis Benzinger
Hayri ERDENER schrieb: > hi to all, > is it possible in python to pass arguments by using command prompt in > windows 2000 and XP ? > for example: > sourceCode.py factorial 4 > gives me the factorial of 4 namely 24. > best regards import sys print sys.argv Or use the optparse module. Docs:

Downloadable python-dev archive February 2005 contains only one mail?

2005-02-08 Thread Dennis Benzinger
Hi! I just downloaded the archive of the python-dev mailing list for February 2005 from http://mail.python.org/pipermail/python-dev/2005-February.txt.gz and there is only one mail in it. Did anyone have this problem, too? Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-list

Re: pyclbr

2005-02-10 Thread Dennis Benzinger
Fernando San MartÃn Woerner wrote: > Hi guys! > > i'm using pycblr to implement a class browser for my app, i got some > issues about it: > > i did: > > dict = pyclbr.readmodule(name, [dir] + sys.path) Don't use dict (or the name of any other built-in function) as an identifier! It shadows the

Re: Multiple initialization methods?

2005-02-16 Thread Dennis Benzinger
alex wrote: > Hi, > > it is possible to define multiple initialization methods so that the > method is used that fits? No, there is no overloading in Python. > I am thinking of something like this: > > def __init__(self, par1, par2): > self.init(par1, par2); > > def __init__(self, par1

Re: Whats up with re module vs pre

2005-02-17 Thread Dennis Benzinger
pythonUser_07 wrote: > This is a very generic observation as I don't have a lot of specifics > with me right now. I have noticed over the past two years that the > python "re" module is somewhat unreliable. What do you mean with unreliable? Can you show an example where re does not work as expe

Re: recombination variations

2004-11-30 Thread Dennis Benzinger
David Siedband wrote: > [...] > Is there a better way to do this? > [...] Take a look at Biopython: http://biopython.org/ Your problem may be solved there already. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython bug

2004-12-09 Thread Dennis Benzinger
Jive wrote: > [...] > What to do? Ask in comp.soft-sys.wxwindows -- http://mail.python.org/mailman/listinfo/python-list

Re: pywhich script - where is that module?

2004-12-17 Thread Dennis Benzinger
Thomas Guettler wrote: > [...] > Nice, you could add it to the python cookbook. > [...] Just in the case the OP doesn't know where to find the cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - default values of a function

2004-12-22 Thread Dennis Benzinger
Bulba! wrote: > [...] > But why the following happens? > > def j(a,i=0): > > ... i=i+1 > ... return (a, i) > ... > j(2) > > (2, 1) > j(3) > > (3, 1) > j(5) > > (5, 1) > > > From Language Reference: > > http://www.python.org/doc/2.3.4/ref/function.html > > "Default

Re: build flow? SCons? AAP? process creation?

2005-04-13 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: [...] So if I do wind up having to write this thing myself, I've been checking the docs on process creation, and have a couple questions if anyone can fill me in. It looks like the os.spawn* commands can start nonblocking sub-processes, but there doesn't seem to be a way

Re: RE Engine error with sub()

2005-04-15 Thread Dennis Benzinger
Maurice LING schrieb: Hi, I have the following codes: from __future__ import nested_scopes > [...] Are you still using Python 2.1? In every later version you don't need the "from __future__ import nested_scopes" line. So, if you are using Python 2.1 I strongly recommend upgrading to Python 2.4.1. [

Re: How To Read Excel Files In Python?

2005-12-13 Thread Dennis Benzinger
Anand schrieb: > Hello, > > Can I get some help on how to read the excel files using python? > [...] Besides using the Excel component you could use the pyExcelerator module. You even don't need Windows for it. Bye, Dennis -- http://mail.python.

Re: Newbie needs help with regex strings

2005-12-14 Thread Dennis Benzinger
Catalina Scott A Contr AFCA/EVEO schrieb: > I have a file with lines in the following format. > > pie=apple,quantity=1,cooked=yes,ingredients='sugar and cinnamon' > Pie=peach,quantity=2,ingredients='peaches,powdered sugar' > Pie=cherry,quantity=3,cooked=no,price=5,ingredients='cherries and sugar'

Re: Newbie needs help with regex strings

2005-12-14 Thread Dennis Benzinger
Christopher Subich schrieb: > Paul McGuire wrote: > > [...] > For the example listed, pyparsing is even overkill; the OP should > probably use the csv module. But the OP wants to parse lines with key=value pairs, not simply lines with comma separated values. Using the csv module will just separa

Re: to write set of values to a file from python

2005-12-14 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > hi everybody > > i want to write a set of values to a file from python. > For ex:: the fields name will "comp name", "ip addr", "mac addr" etc. > And below all these fields i ll have the values for these fields. > > it should look some what like this. > > comp name

Re: Python newbie needs help

2005-12-14 Thread Dennis Benzinger
Ron Hudson schrieb: > [...] > I have a .py file with some def scripts(?) in it. def is the begining of a function definition. > [...] > I am using "Import" to read it after I start an interactive python. > What I need > right now is I seem to have some sort of scoping problems with the > wor

Re: set & random.choice question

2005-12-14 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > I want to do something like this: > > from random import choice > x = set(("jenny", "jacqui", "claire", "chris", "tracy")) > somebody = random.choice(x) > > but I bet a "TypeError: unindexable object" error. Any suggestions for > an elegant workaround? > > I'm

Re: to write set of values to a file from python

2005-12-14 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > [...] > its printing each character in a seperate row where as > i wanteach string in a seperate column? > > so how can i do that?? Any help for this. > [...] Could you post your code here? Or explain what you did exactly. Bye, Dennis -- http://mail.python.o

SVG rendering with Python

2005-12-14 Thread Dennis Benzinger
Hi! Does anybody know of a SVG rendering library for Python? Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-list

Re: Which package to choose?

2005-12-21 Thread Dennis Benzinger
ankit schrieb: > Hi pupil, please let me know which package to choose for xml processing > in python . > Here are my requirements > > "I want a package which provides me schema support along with minidom > support. > According to my findings, "libxml2" provides schema support but it > needs either

Re: How to get the type of an object?

2005-12-21 Thread Dennis Benzinger
Licheng Fang schrieb: > I wrote a function with a list as its parameter. And the function has > to perform different operations based on the datatypes of the elements. > How can I decide whether an object is, say, a list or a string? > > Thanks. > To check if an object is of a particular type us

Re: how to test for a dependency

2006-01-09 Thread Dennis Benzinger
Darren Dale schrieb: > Hello, > > I would like to test that latex is installed on a windows, mac or linux > machine. What is the best way to do this? This should work: > > if os.system('latex -v'): > print 'please install latex' > > but I dont actually want the latex version information to p

Re: Client/Server Question

2006-07-28 Thread Dennis Benzinger
[EMAIL PROTECTED] wrote: > My server.py looks like this > > -CODE-- > #!/usr/bin/env python > import socket > import sys > import os > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > host = '' > port = 2000 > >

Re: Client/Server Question

2006-07-29 Thread Dennis Benzinger
[EMAIL PROTECTED] wrote: > Is os.system() going to be deprecated in future ?.I read somewhere. > [...] Sometime in the future it will. But that won't happen soon. Read the second paragraph of "Backwards Compatibility" in the subprocess PEP . Dennis

Re: Newbie help - test for data type

2006-07-31 Thread Dennis Benzinger
Jonathan Bowlas wrote: > Hi Listers, > > I have a requirement to test for a data type could someone tell me if this > is possible in python? > > Basically I have a ZPT in Zope that users can select checkboxes in a form > which pass arguments for a python function, however if there is only one > c

strftime replacement which supports Unicode format strings?

2006-08-06 Thread Dennis Benzinger
Is there a library with a strftime replacement which supports Unicode format strings? Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-list

Re: item access time: sets v. lists

2006-10-04 Thread Dennis Benzinger
e(1)):pass","") > >>> t2=timeit.Timer("for i in list(xrange(1)):pass","") > [...] You're measuring the time for creating the xrange and the set/list too. Create them before you call Timer() and repeat your timing. Dennis Benzinger -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check for instances of a class

2006-11-14 Thread Dennis Benzinger
On 14 Nov 2006 11:00:53 -0800 [EMAIL PROTECTED] wrote: > Traversing a list of variables, I need to check wheter an element in > the list is an instance of a (user defined) class. What cind of > comparison operator can I use? Can't seem to find this in the > documentation. I anyone have an example

Re: Using pysqlite2

2006-06-02 Thread Dennis Benzinger
[EMAIL PROTECTED] wrote: > Is it possible to use this for sending triggers to a sqlite db?Could > someone provide me with an example of how to do this please? > Thanks Do you want to implement a trigger for a SQLite database in Python? That won't work. Triggers in SQLite can only contain UPDATE,

Re: in python , could I accomplish the purpose that "a=Console.read()" used in C?

2006-06-04 Thread Dennis Benzinger
python wrote: > in python , could I accomplish the purpose that "a=Console.read()" used > in C? > when program is running, I wanna add a statement like > "a=Console.read()" in C language,it will wait for user's input, after > user's typing a character , and click "enter" key, the program will go >

Re: How do I automatically redirect stdout and stderr when using os.popen2?

2006-06-07 Thread Dennis Benzinger
[EMAIL PROTECTED] wrote: > How do I automatically redirect stdout and stderr when using os.popen2 > to start a long running process. If the process prints a lot of stuff > to stdout it will eventually stop because it runs out of buffer space. > Once I start reading the stdout file returned by os.p

Re: creating and naming objects

2006-06-07 Thread Dennis Benzinger
Brian wrote: > [...] > For example, lets say that I have a class that creates a student > object. > > Class Student: > def setName(self, name) > self.name = name > def setId(self, id) > self.id = id > > Then I instantiate that object in a method: > > def createStudent():

Re: tracking dependencies

2006-06-08 Thread Dennis Benzinger
Michele Simionato wrote: > I have a big framework (not written by me) with lots of internal > dependencies and I am > looking for a tool to see the dependency tree. I.e. given a module x, > it should show me all the modules imported by x, and the modules > imported > by them recursively. Standard l

Re: Python with Eclipse

2006-06-19 Thread Dennis Benzinger
Stan Cook wrote: > I've been trying to use Eclipse with Python on Linux for a while and > have noticed something odd. After running the code or debugging a few > times, its responsiveness gets really bad. Upon checking the equivalent > of the task manager, I find several instances of Python ru

Re: Python with Eclipse

2006-06-20 Thread Dennis Benzinger
Philippe Martin wrote: > Dennis Benzinger wrote: > >> Stan Cook wrote: >>> I've been trying to use Eclipse with Python on Linux for a while and >>> have noticed something odd. After running the code or debugging a few >>> times, its responsiveness ge

Problem with sets and Unicode strings

2006-06-27 Thread Dennis Benzinger
Hi! The following program in an UTF-8 encoded file: # -*- coding: UTF-8 -*- FIELDS = ("Fächer", ) FROZEN_FIELDS = frozenset(FIELDS) FIELDS_SET = set(FIELDS) print u"Fächer" in FROZEN_FIELDS print u"Fächer" in FIELDS_SET print u"Fächer" in FIELDS gives this output False False Traceback (mos

Re: Python UTF-8 and codecs

2006-06-27 Thread Dennis Benzinger
Mike Currie wrote: > I'm trying to write out files that have utf-8 characters 0x85 and 0x08 in > them. Every configuration I try I get a UnicodeError: ascii codec can't > decode byte 0x85 in position 255: oridinal not in range(128) > > I've tried using the codecs.open('foo.txt', 'rU', 'utf-8',

Re: Problem with sets and Unicode strings

2006-06-27 Thread Dennis Benzinger
Serge Orlov wrote: > On 6/27/06, Dennis Benzinger <[EMAIL PROTECTED]> wrote: >> Hi! >> >> The following program in an UTF-8 encoded file: >> >> >> # -*- coding: UTF-8 -*- >> >> FIELDS = ("Fächer", ) >> FROZEN_FIELDS

Re: Problem with sets and Unicode strings

2006-06-28 Thread Dennis Benzinger
Serge Orlov wrote: > On 6/27/06, Dennis Benzinger <[EMAIL PROTECTED]> wrote: >> Serge Orlov wrote: >> > On 6/27/06, Dennis Benzinger <[EMAIL PROTECTED]> wrote: >> >> Hi! >> >> >> >> The following program in an UTF-8 encoded

Re: Problem with sets and Unicode strings

2006-06-28 Thread Dennis Benzinger
Robert Kern wrote: > Dennis Benzinger wrote: >> Serge Orlov wrote: >>> On 6/27/06, Dennis Benzinger <[EMAIL PROTECTED]> wrote: >>>> Hi! >>>> >>>> The following program in an UTF-8 encoded file: >>>> >>>> >>

Re: Problem with sets and Unicode strings

2006-06-29 Thread Dennis Benzinger
Diez B. Roggisch wrote: >> But I'd say that it's not intuitive that for sets x in y can be false >> (without raising an exception!) while the doing the same with a tuple >> raises an exception. Where is this difference documented? > > 2.3.7 Set Types -- set, frozenset > > ... > > Set elements ar

Re: Problem with sets and Unicode strings

2006-06-29 Thread Dennis Benzinger
Robert Kern wrote: > Dennis Benzinger wrote: >> Ok, I understand. >> But isn't it a (minor) problem that using a set like this: >> >> # -*- coding: UTF-8 -*- >> >> FIELDS_SET = set(("Fächer", )) >> >> print u"Fächer"

Re: change the size of front

2006-07-04 Thread Dennis Benzinger
aliassaf wrote: > hi, > I want to change the size of the front in a legend, i wrote this small > program and it got to me this message error!!! > > from pylab import * > plot([1,2,3],'r') > legend('this',prop = FontProperties('smaller') ) Try legend('this',prop = matplotlib.font_manager.FontPro

Re: Finding Return Code From GPG

2006-07-04 Thread Dennis Benzinger
Nomen Nescio wrote: > I'm running gpg in python to verify a signature. I can see that it is > working, because gpg is displaying the results. > > But I need a way to let the python script know this. According to the gpg > manual there is a return code from gpg of 0 if the verify is good and 1 if >

Re: automatically grading small programming assignments

2006-12-14 Thread Dennis Benzinger
Am Thu, 14 Dec 2006 12:27:07 -0500 schrieb Brian Blais <[EMAIL PROTECTED]>: > Hello, > > I have a couple of classes where I teach introductory programming > using Python. What I would love to have is for the students to go > through a lot of very small programs, to learn the basic programming >

Re: sha, PyCrypto, SHA-256

2006-12-16 Thread Dennis Benzinger
Am 16 Dec 2006 11:17:19 -0800 schrieb [EMAIL PROTECTED]: > Operating system: Win XP > Vsn of Python: 2.4 > > Situation is this: Required to calcluate a message digest. The > process for calcluating the digest must use an SHA-256 algorithm. > > Questions: > 1) Is it correct that the sha module c

Re: url filtering

2006-12-17 Thread Dennis Benzinger
Am Sun, 17 Dec 2006 20:14:32 +0100 schrieb vertigo <[EMAIL PROTECTED]>: > Hello > > I want to do some text analysis based on html documents grabbed from > internet. > Is there any library which could allow me easily getting text from > html documents > (cutting javascript, html tags and other n

Re: Python and XML Schema

2006-01-25 Thread Dennis Benzinger
Trond wrote: > I have a need to, given a XML document with XML Schema defined, to get the > type of each element in the XML file based on the XML Schema URI given. IE, > the element is of simple datatype string. Is there any existing > Python libraries were I can parse the XML file, and for a g

Re: Strange behavior with os call in cgi script

2006-02-05 Thread Dennis Benzinger
sophie_newbie schrieb: > I have written a cgi script that seems to run perfectly from the > command line when I simulate some cgi input using > os.environ['QUERY_STRING']. > > The thing is that when I run it from the browser, one of my os.system > calls, which gets excecuted fine when running the

Re: Most prominent Tkinter applications?

2006-02-05 Thread Dennis Benzinger
Kevin Walzer schrieb: > I'm looking for examples of "best practices" in Tkinter/Python > programming. What are the most prominent Python applications out there > that use Tkinter as the GUI toolkit? These can be commercial or > open-source, but are preferably multi-platform. > > I know IDLE is wri

Re: apache mod_python problem

2006-02-15 Thread Dennis Benzinger
Ido Yehieli schrieb: > [...] > Anyone has any idea as to what went wrong? > [...] If you compiled mod_python as a Dynamic Shared Object (DSO) you have to tell Apache to load that module. For example like this: LoadModule python_module libexec/mod_python.so See the mod_python documentation, espe

Outdated Python Info on www.unicode.org

2006-03-03 Thread Dennis Benzinger
ort in Python update this information? Thanks, Dennis Benzinger -- http://mail.python.org/mailman/listinfo/python-list

Re: Self-modifying Code

2005-05-19 Thread Dennis Benzinger
[EMAIL PROTECTED] schrieb: > [...] > Also Python can (writing and running a module, in-line): > > fNew =open("newModule.py",'w') > lNew=['print 123\n','print 454\n','print 789\n'] > fNew.writelines(lNew) > fNew.close() > from newModule import * > [...] You don't even need a file for this. Try: e

Update Demo/ and Tools/ directories

2006-04-24 Thread Dennis Benzinger
Hi! I'd like to help with updating the Demo/ and Tools/ directories as it is suggested in the Python Wiki . How exactly should the directories be updated? Should it just be made sure that the demos and examples are working or should they be updated to us

Re: File encoding strategy question

2006-05-21 Thread Dennis Benzinger
Andrew Robert schrieb: > Hi everyone, > > I am in the process of creating a file transmit/receiver program using > MQSeries. > > The way it works is through creation of an XML message. > > Elements within the XML message contain things such as file name, size, > and the file contents. > > The f

Re: escapes in regular expressions

2006-05-21 Thread Dennis Benzinger
James Thiele schrieb: > I was helping a guy at work with regular expressions and found > something I didn't expect: > > re.match('\d', '7').group() > > '7' '\d' is not recognized as a escape sequence by Python and therefore it is left unchanged in t

Re: Class probkem - getting msg that self not defined

2006-05-22 Thread Dennis Benzinger
wes weston schrieb: > Andrew Robert wrote: > >> wes weston wrote: >> >>> Andrew Robert wrote: >>> Hi Everyone, I am having a problem with a class and hope you can help. When I try to use the class listed below, I get the statement that self is not defined.