Re: [Tutor] Space the final frontier!

2006-04-04 Thread Ryan Ginstrom
[Sorry for the initial misfire, John] > [mailto:[EMAIL PROTECTED] On Behalf Of John Corry > 001,newfield,dial=02890790154,dial= > 002,borfiled,dial=02890618521,dial= > 003,newcomp,dial=02890419689,dial= Hi John: I believe the common idiom in this case is ''.join( theString.split( ' ' ) ) >>> th

Re: [Tutor] Question about large numbers of arguments

2006-04-04 Thread Bob Gailer
Dana Robinson wrote: > Hello, > > Suppose you have a situation where you have a large number of command-line > options that you will parse with getopt. You want to keep track of these > as you move around in the code and do various things. > > Is it more Pythonic to: > > Have the functions take la

Re: [Tutor] Space the final frontier!

2006-04-04 Thread Matthew White
Hi John, It would be easier to do all of your whitespace elimination before you append the string to your list(s). Something like this I should get you started: for line in input.readlines(): line = re.sub('[\s]+', '', line) listy.append(line) print listy bonus points for appe

[Tutor] Question about large numbers of arguments

2006-04-04 Thread Dana Robinson
Hello, Suppose you have a situation where you have a large number of command-line options that you will parse with getopt. You want to keep track of these as you move around in the code and do various things. Is it more Pythonic to: Have the functions take large numbers of parameters. or Crea

[Tutor] Space the final frontier!

2006-04-04 Thread John Corry
Dear All, I am having difficulty removing white spaces from my file. The file is 999 lines long and looks like the sample below: 001, new field,dial= 028 90 79 0154, dial= 002, borfiled, dial= 02890 618521, dial= 003, newcomp, dial=02890419689, dial= The program, I am using to import the file d

Re: [Tutor] Protected methods/variables

2006-04-04 Thread Kent Johnson
Mike Hansen wrote: >>> - you can use __slots__ to restrict arbirtrary creation of >> (dynamic) >>> instrance attributes >> You can do this, but it is generally considered a misuse of >> __slots__ and potentially problematic. >> > > I'll bite. What is the proper/intended use of __slots__? Does i

Re: [Tutor] Protected methods/variables

2006-04-04 Thread Mike Hansen
> > - you can use __slots__ to restrict arbirtrary creation of > (dynamic) > > instrance attributes > > You can do this, but it is generally considered a misuse of > __slots__ and potentially problematic. > I'll bite. What is the proper/intended use of __slots__? Does it have something to do

Re: [Tutor] Protected methods/variables

2006-04-04 Thread Kent Johnson
w chun wrote: >> I have missed protected method/variables in Python. How do you declare >> methods/variables used only by a class and their derived classes? > > hi Ktalà, > > welcome to Python! you missed "protection" in OOP with Python bceause > there are no such declarations in Python! > > 1)

Re: [Tutor] Protected methods/variables

2006-04-04 Thread w chun
> I have missed protected method/variables in Python. How do you declare > methods/variables used only by a class and their derived classes? hi Ktalà, welcome to Python! you missed "protection" in OOP with Python bceause there are no such declarations in Python! 1) there is a privacy *hint*, wh

Re: [Tutor] Protected methods/variables

2006-04-04 Thread Alan Gauld
"Miquel Oliete" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have been programming in object oriented languages for several years > and I'm learning python now. Congratulations :-) > I have missed protected method/variables in Python. In what sense have you missed them? Have

Re: [Tutor] Bits

2006-04-04 Thread Alan Gauld
"Øyvind" <[EMAIL PROTECTED]> wrote in message > Is it possible to read the bits (the 0's and 1's) of a string or a file > with Python? What module would I use? Yes, you can read the bits by reading bytes and applying bitmasks and bitwise operations. You can get the bytes using the struct module

Re: [Tutor] defined()

2006-04-04 Thread Alan Gauld
>> Which language(s) do you know that has such a feature? > > I should came from Marco Cantu's Delphi 2005 book, that I have read just > recently. > But I am unable to find it again. I'd be very surprised if it came from Delphi for two reasons: a) I used Delphi a lot for several years and never c

[Tutor] Protected methods/variables

2006-04-04 Thread Miquel Oliete
Hello everybody I have been programming in object oriented languages for several years and I'm learning python now. I have missed protected method/variables in Python. How do you declare methods/variables used only by a class and their derived classes? Thanks in advance -- Miquel Oliete (a.

Re: [Tutor] Bits

2006-04-04 Thread Kent Johnson
Øyvind wrote: > Hello. > > Is it possible to read the bits (the 0's and 1's) of a string or a file > with Python? What module would I use? I don't know exactly what you mean by "read the bits" but you can use data = open('afile', 'b').read() to get the data into a string byte1=ord(data[1]) to get

[Tutor] Bits

2006-04-04 Thread Øyvind
Hello. Is it possible to read the bits (the 0's and 1's) of a string or a file with Python? What module would I use? Thanks in advance, Øyvind -- This email has been scanned for viruses & spam by Decna as - www.decna.no Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no ___

Re: [Tutor] how to get data from xml

2006-04-04 Thread Kent Johnson
ទិត្យវិរៈ wrote: > Dear all Pythoners, > > I am quiet new to python and now working with xml. I have an xml like this: > > > > > > 0x6B > 0x78 > 0x4B > 0x58 > 0x67 > 0x63 > 0x71 > 0x43

Re: [Tutor] Bigrams and nested dictionaries

2006-04-04 Thread Kent Johnson
Michael Broe wrote: > dict = {} dict is the name of the builtin dictionary class, so you shouldn't use it as the name of your dict - you shadow the built-in name. file is also a built-in name. > > L = file[0] > for R in file[1:]:# move right edge of window across the file > if not L

[Tutor] how to get data from xml

2006-04-04 Thread ទិត្យវិរៈ
Dear all Pythoners, I am quiet new to python and now working with xml. I have an xml like this: 0x6B 0x78 0x4B 0x58 0x67 0x63 0x71 0x43 0x51 0x6A and I want to

Re: [Tutor] Hi

2006-04-04 Thread Steve Nelson
On 4/4/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: > Hi ALL > > A simple query is that the python mailing List is python powered > > What does "python powered" means The list, and many like it, use a piece of software called Mailman, which is written in Python. A few years back, the tool of ch

Re: [Tutor] file?

2006-04-04 Thread Alan Gauld
> How can we know that one specific file is already exist in filesystem? > for instance, I want to read zipfile by issuing code: Take a look in the os.path module. There is explanation of how to check for various aspects of files (including existence) in my web tutor Operating System topic. > i