Re: [Tutor] Running an exe from Python

2007-02-23 Thread Alan Gauld
"Rikard Bosnjakovic" <[EMAIL PROTECTED]> wrote >> How can I get python to display >> the results in the interactive window or what is the right way to >> do this. > > Use os.popen: As Rikard, Richard and Hugo have pointed out there are numerous ways to do this in Python. The officially sanctio

[Tutor] Managing XML in Python

2007-02-23 Thread Ketan Maheshwari
Hi: I have to manage XML files through python. The activities include, create, update and retrieve information from the XML files. I would be thankful for pointers to tutorials, APIs and suggestions. Regards Ketan ___ Tutor maillist - Tutor@p

Re: [Tutor] Add metadata to a dir of files.

2007-02-23 Thread Mark Bystry
Ok, Tim. I believe you're right. If the vbscript is working then I'll continue to use it and expand on it. I'll only be using this on my WinXP box anyway. I just didn't want to offend anyone in this mailing list with vbscript code. I'm really trying to learn some python basics but I'm no progr

Re: [Tutor] Add metadata to a dir of files.

2007-02-23 Thread Tim Golden
Mark Bystry wrote: > Ok, Tim. I believe you're right. If the vbscript is working then I'll > continue to use it and expand > on it. I'll only be using this on my WinXP box anyway. I just didn't want to > offend anyone in this > mailing list with vbscript code. I'm really trying to learn some py

[Tutor] index swap?

2007-02-23 Thread Switanek, Nick
Hi, I'm trying to subset a large dataset (too many rows for Excel, currently too ragged for Access), and I am mystified by the behavior of a seemingly simple script I've written. Please help me understand what I'm overlooking. data = file(inpath).readlines() data = [line.rstrip() for line

Re: [Tutor] Managing XML in Python

2007-02-23 Thread Kent Johnson
Ketan Maheshwari wrote: > Hi: > I have to manage XML files through python. The activities include, > create, update and retrieve information from the XML files. > > I would be thankful for pointers to tutorials, APIs and suggestions. Take a look at the ElementTree module. In Python 2.5 i

Re: [Tutor] index swap?

2007-02-23 Thread Kent Johnson
Switanek, Nick wrote: > Hi, > > > > I’m trying to subset a large dataset (too many rows for Excel, currently > too ragged for Access), and I am mystified by the behavior of a > seemingly simple script I’ve written. Please help me understand what I’m > overlooking. > > data = file(inpath).re

[Tutor] miniwiki 1.3 BETA bugs

2007-02-23 Thread Kirk Z. Bailey
ok, let's post this again. last time went into purgatory instead of the list. hmmm I am working on updating miniwiki. the current beta code has rendering problems with wikiwords and external sites under some circumstances. Here is a link to the latest code: http://www.tinylist.org/MW.t

Re: [Tutor] miniwiki 1.3 BETA bugs

2007-02-23 Thread Luke Paireepinart
Kirk Z. Bailey wrote: > ok, let's post this again. last time went into purgatory instead of the list. > hmmm > > I am working on updating miniwiki. the current beta code has rendering > problems with wikiwords and external sites under some circumstances. What circumstances are these, exactly

Re: [Tutor] DICOM Header

2007-02-23 Thread Bill Sconce
On Thu, 22 Feb 2007 13:51:35 -0700 "Andrew Liimatta" <[EMAIL PROTECTED]> wrote: > I have a directory that is filled with DICOM files that I obtained > by using the Offis DICOM tool kit. Ah. The light dawns. I should offer to communicate with you off-list, and report back here after we've solved

Re: [Tutor] How many loops does "break" jump out of?

2007-02-23 Thread Chuck Coker
Bob, Watch your code blocks to make sure you don't change your logic inadvertently. The code starting with "if (test_2)" and continuing to the end of the snippet is inside the perpetual for loop which is inside the "if (test_1)" condition. Chuck Bob Gailer wrote: > [EMAIL PROTECTED] wrote: >

[Tutor] dictionaries and memory handling

2007-02-23 Thread Arild B. Næss
Hi, I'm working on a python script for a task in statistical language processing. Briefly put it all boils down to counting different things in very large text files, doing simple computations on these counts and storing the results. I have been using python's dictionary type as my basic d

Re: [Tutor] dictionaries and memory handling

2007-02-23 Thread Bill Campbell
On Fri, Feb 23, 2007, =?ISO-8859-1?Q? Arild_B._N=E6ss ?= wrote: >Hi, > >I'm working on a python script for a task in statistical language >processing. Briefly put it all boils down to counting different >things in very large text files, doing simple computations on these >counts and storing t

[Tutor] Programming the behavior of a set of domino

2007-02-23 Thread Chung-hong Chan
Hello, I am a newbie in computer programming and I am also not a native English Speaker. I love to play domino and I would like to program a simple domino game in python. Also a good opportunity for me to learn some computer programming. I need some help in my code which programming the behaviors

Re: [Tutor] dictionaries and memory handling

2007-02-23 Thread Alan Gauld
"Bill Campbell" <[EMAIL PROTECTED]> wrote >>It seems that an SQL database would probably be the way to go, but I >>am a bit concerned about speed issues (even though running time is > ... > You would probably be better off using one of the hash databases, > Berkeley, gdbm, etc. (see the anydbm doc

Re: [Tutor] dictionaries and memory handling

2007-02-23 Thread Bill Campbell
On Fri, Feb 23, 2007, Alan Gauld wrote: >"Bill Campbell" <[EMAIL PROTECTED]> wrote > >>>It seems that an SQL database would probably be the way to go, but I >>>am a bit concerned about speed issues (even though running time is >> ... >> You would probably be better off using one of the hash databas

[Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Adam Pridgen
Hello, When I have a tuple with a single string in a dictionary entry and try to iterate over the tuple and it breaks the string into individual characters. Is this supposed to be happening? This problem is a little tricky to explain so I have included the output and the corresponding example c

Re: [Tutor] miniwiki 1.3 BETA bugs

2007-02-23 Thread Barnaby Scott
Kirk Z. Bailey wrote: > ok, let's post this again. last time went into purgatory instead of the list. > hmmm > > I am working on updating miniwiki. the current beta code has rendering > problems with wikiwords and external sites under some circumstances. Here is > a link to the latest code:

Re: [Tutor] stumped again adding bytes

2007-02-23 Thread shawn bright
ok, i am good with what you have explained here, now i am on a similar problem. the data i need is in a condensed format. in other words, they are sending 2 values in three bytes. so if i have 3 values say a = 53, b = 13, and c = 31 so value 1 is the first byte ( a ) and the first 4 bits of the

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Luke Paireepinart
Adam Pridgen wrote: > Hello, > > When I have a tuple with a single string in a dictionary entry and > try to iterate over the tuple and it breaks the string into individual > characters. Is this supposed to be happening? > > This problem is a little tricky to explain so I have included the > outpu

Re: [Tutor] stumped again adding bytes

2007-02-23 Thread Luke Paireepinart
shawn bright wrote: > ok, i am good with what you have explained here, > now i am on a similar problem. > > the data i need is in a condensed format. in other words, they are > sending 2 values in three bytes. > > so if i have 3 values say a = 53, b = 13, and c = 31 > > so value 1 is the first byte

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Tim Golden
Luke Paireepinart wrote: > That's because you can't make tuples of single values. > Parenthesis are ways of controlling order of operation. > They don't create tuples unless there's more than one value. > Think of it like this: > a TUple needs TWO elements or more. > Solution: > use lists. They

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Bill Sconce
Don't feel bad. Everyone who works with Python bumps into this. And more than once... The preceding reply is correct. But perhaps this is more specific: > TYPES_PYTHON_TO_XML = { >'int':('xs:hexbinary','xs:integer'), >'str':("xs:string") >} The problem is h

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Luke Paireepinart
Tim Golden wrote: > Luke Paireepinart wrote: > >> That's because you can't make tuples of single values. >> Parenthesis are ways of controlling order of operation. >> They don't create tuples unless there's more than one value. > >> Think of it like this: >> a TUple needs TWO elements or more. >> S

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Terry Carroll
On Fri, 23 Feb 2007, Luke Paireepinart wrote: > That's because you can't make tuples of single values. > Think of it like this: > a TUple needs TWO elements or more. No, a tuple can also be of one element, or even none. You can create a single-element tuple either directly through the use of a t

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Terry Carroll
On Fri, 23 Feb 2007, Bill Sconce wrote: > It's not true that >parentheses indicate tuples > (They don't. Not unless there are "commas in there".) Except in one case, the empty tuple: t = () ___ Tutor maillist - Tutor@python.org http://mail.pyt

Re: [Tutor] stumped again adding bytes

2007-02-23 Thread shawn bright
Thanks for your help, Luke. i am trying to get a grasp on how all this works, which is the msb, lsb, etc.. if i use i bitmask of 240 it will mask the most significant 4 bits so that only the most significant 4 bits remain.. like 53 & 240 = 48 ( because only the 32 and 16 are set) and if i use 15 i

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Terry Carroll
On Fri, 23 Feb 2007, Terry Carroll wrote: > You can also create an empty tuple, but I think only through the tuple() > method: > >>> t=tuple() > > Any other way to create an empty tuple? Answering my own question: >>> t=() >>> type(t) ___ Tutor m

Re: [Tutor] stumped again adding bytes

2007-02-23 Thread shawn bright
whoops, meant this to the list, sorry Luke. On 2/23/07, shawn bright <[EMAIL PROTECTED]> wrote: > Thanks for your help, Luke. > i am trying to get a grasp on how all this works, which is the msb, lsb, etc.. > > if i use i bitmask of 240 it will mask the most significant 4 bits > so that only the m

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Luke Paireepinart
Terry Carroll wrote: > On Fri, 23 Feb 2007, Luke Paireepinart wrote: > > >> That's because you can't make tuples of single values. >> Think of it like this: >> a TUple needs TWO elements or more. >> > > No, a tuple can also be of one element, or even none. You can create a > single-element

Re: [Tutor] Programming the behavior of a set of domino

2007-02-23 Thread Bob Gailer
Chung-hong Chan wrote: > Hello, > > I am a newbie in computer programming and I am also not a native > English Speaker. I love to play domino and I would like to program a > simple domino game in python. Also a good opportunity for me to learn > some computer programming. > I need some help in my c

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Bill Sconce
On Fri, 23 Feb 2007 13:45:54 -0800 (PST) Terry Carroll <[EMAIL PROTECTED]> wrote: > > Any other way to create an empty tuple? > > Answering my own question: > > >>> t=() > >>> type(t) > Giving the lie to my earlier summary (that tuples are indicated by commas only -- arrgh :) __

Re: [Tutor] stumped again adding bytes

2007-02-23 Thread Alan Gauld
"shawn bright" <[EMAIL PROTECTED]> wrote > so i believe i do shifting here. as in i do a > (a << 4) * 32 + b > Don't use shifting to extract the bits, use a bitmask and & its much easier. If you want to extract the left-most 4 bits use 0xf0 If you want to extract the righ-most bits use 0x0f 1

Re: [Tutor] stumped again adding bytes

2007-02-23 Thread Alan Gauld
"shawn bright" <[EMAIL PROTECTED]> wrote > if i use i bitmask of 240 it will mask the most significant 4 bits When using bitmasks its much easier to think in hex (or octal). there are exactly 2 hex digits per byte so you only need to think about each group of 4 bits and its hex bit pattern. It