Tkinter - cannot import tklib

2022-06-20 Thread Wolfgang Grafen
Hello all, I am an experienced Python user and struggle with following statement: >>> from tklib import * Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'tklib' I tried to import tklib as shown above on following of my Python installations: Anaconda

Vaults of Parnassus hasn't been updated for months

2005-12-23 Thread Wolfgang Grafen
What happened to the Vaults of Parnassus? It was always my favourite resource for Python code since ever. The latest entry is now 8/23. It has been up to date for years but now... What a pity! wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Re: Vaults of Parnassus hasn't been updated for months

2005-12-23 Thread Wolfgang Grafen
the past... Just a poll: Who misses the Vaults of Parnassus like me? Olivier Grisel wrote: > Wolfgang Grafen a écrit : > >> What happened to the Vaults of Parnassus? It was always my >> favourite resource for Python code since ever. The latest >> entry is now 8/23

Re: sort a dictionary by keys in specific order

2006-05-29 Thread Wolfgang Grafen
spohle wrote: > hi i have a normal dictionary with key and value pairs. now i wanna > sort by the keys BUT in a specific order i determine in a list !? any > ideas > > dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'} > > list = [key2, key3, key1] > You could use the seqdict package at

Re: Print dict in sorted order

2006-01-30 Thread Wolfgang Grafen
Use the seqdict.py package: What is it? http://home.arcor.de/wolfgang.grafen/Python/Modules/AllOs/DOC/seqdict/ Downloads: http://home.arcor.de/wolfgang.grafen/Python/Modules/seqdict/seqdict-0.3.zip http://home.arcor.de/wolfgang.grafen/Python/Modules/AllOs/DOC/HTML/HTMLDoc.zip http://home.arcor.de

Re: indentation in python

2007-01-15 Thread Wolfgang Grafen
Dan Bishop wrote: > On Jan 13, 8:49 pm, "lee" <[EMAIL PROTECTED]> wrote: >> Can anyone tell me the basics about indentation in python..how we >> use it in loops and constructs..etc > > It's just like indentation in other languages, except that it's > syntactically required. > The indent r

Re: How to convert float to sortable integer in Python

2007-01-16 Thread Wolfgang Grafen
shellon wrote: > Hi all: > I want to convert the float number to sortable integer, like the > function float2rawInt() in java, but I don't know the internal > expression of float, appreciate your help! > You should know you can sort mixed float/integer values in Python >>> l=[3,2.3,1.45,2,5]

Re: Regular expressions question

2007-01-16 Thread Wolfgang Grafen
Victor Polukcht wrote: > I have 2 strings: > > "Global etsi3 *200 ok30 100% 100% > Outgoing" > and > "Global etsi3 * 4 ok 30 100% 100% > Outgoing" > > The difference is "*200" instead of "* 4". Is there ability to write a > regular ex

Re: Program eating memory, but only on one machine?

2007-01-22 Thread Wolfgang Grafen
I had a similar problem with an extension module on Solaris years ago. My problem at that time: I requested memory and released it and requested more memory in the next step and so on. The reason that the memory was eaten up: An answer out of this group was that the operating system doesn't releas

Re: Find and replace in a file with regular expression

2007-01-31 Thread Wolfgang Grafen
ything but I cannot figure > out how I can do it. > I want to open a a file (not necessary a txt) and find and replace a > string. > I can do it with: > > import fileinput, string, sys > fileQuery = "Text.txt" > sourceText = '''SOURCE''' > replaceText = '''REPLACE''' > def replace(fileName, sourceText, replaceText): Now how to solve it with a simple regular expression: >>> import re >>> re_replace = re.compile("SOURCE").sub >>> >>> txt = " SOURCE SOURCE \n SOURCE " >>> >>> print re_replace("REPLACE", txt) ' REPLACE REPLACE \n REPLACE ' >>> new_text = re_replace("REPLACE", open(fileName).read()) A regular expression for this task is kind of overkill. Mastering regular expression is the efford very worth. Wolfgang Grafen -- http://mail.python.org/mailman/listinfo/python-list

Re: lint for Python?

2008-10-06 Thread Wolfgang Grafen
No need to develop another lint tool. Just give the creator of pylint an improvement proposal. This can be at least reported as a warning. Even in a highly dynamic language like Python it is good to follow some style guides. I try to avoid the same names if possible for different functionality. T

Re: Best way to delimit a list?

2008-05-13 Thread Wolfgang Grafen
[EMAIL PROTECTED] schrieb: Hi - I have a list returned from popen/readlines, and am wondering how to go about iterating over each item which was returned (rather than currently having the whole lot returned). so far: f=os.open("./get_hostnames").readlines returns ['host1 host2 host3 ... host

Re: do you fail at FizzBuzz? simple prog test

2008-05-20 Thread Wolfgang Grafen
globalrev schrieb: http://reddit.com/r/programming/info/18td4/comments claims people take a lot of time to write a simple program like this: "Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-16 Thread Wolfgang Grafen
Armin Ronacher schrieb: Other implementations of ordered dicts in various Python projects or standalone libraries, that inspired the API proposed here, are: - `odict in Babel`_ - `OrderedDict in Django`_ - `The odict module`_ - `ordereddict`_ (a C implementation of the odict module) - `StableDic

Re: bpython - fancy Python shell

2008-06-16 Thread Wolfgang Grafen
I couldn't get it work on Solaris (modified some lines for Python2.3). One reason was that I had to download pyreadline separately - I did than but now pyreadline requires either ironpython or a windows installation. Something is going wrong... Best regards Wolfgang Bob Farrell schrieb: I re

Re: get keys with the same values

2008-06-17 Thread Wolfgang Grafen
You could use my mseqdict implementation of a sorted dict. http://home.arcor.de/wolfgang.grafen/Python/Modules/Modules.html swap: This method can only be applied when all values of the dictionary are immutable. The Python dictionary cannot hold mutable keys! So swap doesn't work if only one of

Re: Parsing VHDL with python, where to start.

2008-07-29 Thread Wolfgang Grafen
Svenn Are Bjerkem schrieb: Hi again, when I get far enough to parse the VHDL (which is not currently the fact, but I have to look at the work coming up downstream) I will have to put it into an internal data structure and then write some classes to handle the MVC between whatever data I have and

Re: Passing an object through COM which acts like str but isn't

2008-08-15 Thread Wolfgang Grafen
Rafe schrieb: Forgive me if I mangle any terminology here, but please correct me if I do... I have an object which acts exactly like a string as long as I stay in Python land. However, I am using the object in Softimage|XSI, a 3D application on Windows. I'm getting variant erros when trying to u

Re: Passing an object through COM which acts like str but isn't

2008-08-15 Thread Wolfgang Grafen
Rafe schrieb: On Aug 15, 10:27 pm, Wolfgang Grafen <[EMAIL PROTECTED]> wrote: Rafe schrieb: Now if I try to pass this as I would a string, roughly like so... s = StrLike("test") Application.AnObject.attribute = "test" # works fine Application.AnObject.attribute =