Re: Newbie question...

2008-09-29 Thread Tim Leslie
On Tue, Sep 30, 2008 at 12:04 PM, Ken D'Ambrosio [EMAIL PROTECTED] wrote: First, apologies for such a newbie question; if there's a better forum (I've poked around, some) feel free to point it out to me. Anyway, a mere 25-odd years after first hearing about OOP, I've finally decided to go

Re: Python newbie question re Strings and integers

2008-09-22 Thread Bruno Desthuilliers
rmac a écrit : Ah! Arghh!!! You are so correct on the usage of the ':' Python syntax is a little different from what I am used to. I don't know what you're used to, but chances are that more than the syntax differs !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python newbie question re Strings and integers

2008-09-20 Thread Bruno Desthuilliers
rmac a écrit : the following code attempts to extract a symbol name from a string: extensionStart = int(filename.rfind('.')) rfind returns an int, so passing it to the int type constructor is useless. filenameStart = int(filename.rfind('/')) idem #print 'Extension Start - '

Python newbie question re Strings and integers

2008-09-18 Thread rmac
the following code attempts to extract a symbol name from a string: extensionStart = int(filename.rfind('.')) filenameStart = int(filename.rfind('/')) #print 'Extension Start - ' + str(extensionStart) #print 'FileName Start - ' + str(filenameStart)

Re: Python newbie question re Strings and integers

2008-09-18 Thread Christian Heimes
rmac wrote: the following code attempts to extract a symbol name from a string: extensionStart = int(filename.rfind('.')) filenameStart = int(filename.rfind('/')) #print 'Extension Start - ' + str(extensionStart) #print 'FileName Start - ' + str(filenameStart)

Re: Python newbie question re Strings and integers

2008-09-18 Thread Miki
    currentSymbol=filename[int(filenameStart),int(extensionStart)] Should be currentSymbol=filename[int(filenameStart):int(extensionStart)] (change , to :) You don't need to convert to int all the time, rfind will return an integer. Also you can use os.path for this from os.path import

Re: Python newbie question re Strings and integers

2008-09-18 Thread rmac
Ah! Arghh!!! You are so correct on the usage of the ':' Python syntax is a little different from what I am used to. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

newbie question: how to run a python file if it is in a package

2008-09-05 Thread neoedmund
for example: X.py is in aaa.bbb and it has a line like import aaa.bbb.Y how can I run X.py avoiding it saying such like ImportError: No module named aaa.bbb? Is all runnable script must be in the default package? thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: how to run a python file if it is in a package

2008-09-05 Thread Diez B. Roggisch
neoedmund schrieb: for example: X.py is in aaa.bbb and it has a line like import aaa.bbb.Y how can I run X.py avoiding it saying such like ImportError: No module named aaa.bbb? Is all runnable script must be in the default package? There is no such thing as a default package All imports are

Re: newbie question: how to run a python file if it is in a package

2008-09-05 Thread neoedmund
On Sep 5, 8:12 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: neoedmund schrieb: for example: X.py is in aaa.bbb and it has a line like import aaa.bbb.Y how can I run X.py avoiding it saying such like ImportError: No module named aaa.bbb? Is all runnable script must be in the default

newbie question

2008-08-25 Thread sharon k
hi all, i am new to python. i fetch a webpage with urllib, extract a few numbers in a format as follow; 10,884 24,068 my question is how to remove the comma between the number, since i have to add them up later. sorry for my bad english. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2008-08-25 Thread Gerhard Häring
sharon k wrote: hi all, i am new to python. i fetch a webpage with urllib, extract a few numbers in a format as follow; 10,884 24,068 my question is how to remove the comma between the number, since i have to add them up later. Strings have a replace method. Calling replace(,, ) on the

Re: newbie question

2008-08-25 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi sharon, as I understand, you want to remove certain characters of a string. Try: number = int(fetched_number.replace(',', '')) this will first remove any , characters and then convert the string into an integer. Best, Manuel On Aug 25,

Re: newbie question

2008-08-25 Thread sharon k
thank you for your prompt reply. sorry seems i run into another problem, as follow; a = 12,123 b = str(a) c = int(b.replace(',', '')) Traceback (most recent call last): File stdin, line 1, in module ValueError: invalid literal for int() with base 10: '(12 123)' the comma has

Re: newbie question

2008-08-25 Thread Manuel Ebert
Hi sharon, the problem is here that a = 12,123 will actually create a tuple with two elements (namely 12 and 123): a = 12,123 a (12, 123) Converting this to a string yields '(12, 123)', which is not what you want (sounds confusing, bit soon you'll see how many amazing things can be done

Re: newbie question

2008-08-25 Thread sharon k
much thanks, your instructions are clear, problem solved! :) On Mon, Aug 25, 2008 at 11:43 PM, Manuel Ebert [EMAIL PROTECTED] wrote: Hi sharon, the problem is here that a = 12,123 will actually create a tuple with two elements (namely 12 and 123): a = 12,123 a (12, 123) Converting

Re: Newbie question about sending and receiving data to the command prompt.

2008-08-24 Thread Gabriel Genellina
En Fri, 22 Aug 2008 18:25:49 -0300, n00m [EMAIL PROTECTED] escribió: Is it possible to communicate in loop fashion? import subprocess as s proc = s.Popen('cmd.exe', stdin=s.PIPE, stdout=s.PIPE) while 1: cmd = raw_input('cmd:') res =

Re: Newbie question about sending and receiving data to the command prompt.

2008-08-22 Thread n00m
Is it possible to communicate in loop fashion? import subprocess as s proc = s.Popen('cmd.exe', stdin=s.PIPE, stdout=s.PIPE) while 1: cmd = raw_input('cmd:') res = proc.communicate(cmd + '\n')[0] print res

Re: Newbie question about sending and receiving data to the command prompt.

2008-08-20 Thread Gabriel Genellina
En Tue, 19 Aug 2008 16:48:26 -0300, aditya shukla [EMAIL PROTECTED] escribi�: I am using windows vista and i am trying to send data to the command prompt ,this is what is done. import subprocess proc =subprocess.Popen('cmd.exe',stdin=subprocess.PIPE) proc.communicate('abc') when i run this

Newbie question about sending and receiving data to the command prompt.

2008-08-19 Thread aditya shukla
Hello folks, I am using windows vista and i am trying to send data to the command prompt ,this is what is done. import subprocess proc =subprocess.Popen('cmd.exe',stdin=subprocess.PIPE) proc.communicate('abc') when i run this the command prompt just blinks and disappears , can anyone explain

RE: very newbie question

2008-08-08 Thread Peter Anderson
Try this: # The player tries to guess it and the computer lets # the player know if the guess is too high, too low # or right on the money import random print \tWelcome to 'Guess My Number'! print \nI'm thinking of a number between 1 and 100. print Try to guess it in as few attempts as

very newbie question

2008-08-07 Thread garywood
stuck on python for absolute beginners chapter 6 i actually done what i was supposed to do use the function ask_number for guess a number but for some reason it does not count correctly the number of tries # Guess My Number # # The computer picks a random number between 1 and 100 # The

Re: very newbie question

2008-08-07 Thread Ethan Furman
garywood wrote: stuck on python for absolute beginners chapter 6 i actually done what i was supposed to do use the function ask_number for guess a number but for some reason it does not count correctly the number of tries # Guess My Number # # The computer picks a random number between 1

RE: very newbie question

2008-08-07 Thread Edwin . Madari
:[EMAIL PROTECTED] Behalf Of garywood Sent: Thursday, August 07, 2008 1:56 PM To: python-list@python.org Subject: very newbie question stuck on python for absolute beginners chapter 6 i actually done what i was supposed to do use the function ask_number for guess a number but for some reason

File Locking Forced? Newbie question.

2008-07-15 Thread Sparky
Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can I have it so that the same file can be open in read mode by more than one person or could Window's

Re: File Locking Forced? Newbie question.

2008-07-15 Thread Tim Golden
Sparky wrote: Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can I have it so that the same file can be open in read mode by more than one person or

Re: File Locking Forced? Newbie question.

2008-07-15 Thread Sparky
On Jul 15, 11:38 am, Tim Golden [EMAIL PROTECTED] wrote: Sparky wrote: Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can I have it so that

Newbie question

2008-07-09 Thread |e0
Hi list, i'm running Ubuntu Hardy Desktop and i've installed Tim Golden WMI. However importing wmi module i have this error: import wmi Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/site-packages/wmi.py, line 141, in module from win32com.client

Re: Newbie question

2008-07-09 Thread |e0
So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, |e0 [EMAIL PROTECTED] wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. Welcome to the world outside MS. Many python modules don't actually do anything than passing

Re: Newbie question

2008-07-09 Thread Tim Golden
A.T.Hofkamp wrote: On 2008-07-09, |e0 [EMAIL PROTECTED] wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. Welcome to the world outside MS. Many python modules don't actually do

Re: Newbie question

2008-07-09 Thread |e0
I did not mean to use WMI on linux, but query win machines *from* linux. Thank you for your clarifications - Leonardo On Wed, Jul 9, 2008 at 11:04 AM, A.T.Hofkamp [EMAIL PROTECTED] wrote: Welcome to the world outside MS. Many python modules don't actually do anything than passing on calls to

Re: Newbie question

2008-07-09 Thread Tim Golden
|e0 wrote: I did not mean to use WMI on linux, but query win machines *from* linux. Thank you for your clarifications In principle you ought to be able to use some kind of DCOM bridge (since WMI access if via COM/DCOM). I've no idea if anyone's attempted this or even if all the pieces are in

Re: Newbie question

2008-07-09 Thread Diez B. Roggisch
|e0 wrote: I did not mean to use WMI on linux, but query win machines *from* linux. What do you mean by query? Using the WMI module? No. It's Windows only. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question

2008-07-09 Thread Mike Driscoll
On Jul 9, 2:19 am, |e0 [EMAIL PROTECTED] wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. WMI is a Windows thing. It stands for Windows Management Instrumentation. So it's not

Re: Confused yet again: Very Newbie Question

2008-07-08 Thread Lie
On Jul 7, 7:09 pm, Jeff [EMAIL PROTECTED] wrote: When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function.  Python passes function parameters by value. No, python doesn't pass variable either by value or by reference. The behavior in python is

Confused yet again: Very Newbie Question

2008-07-07 Thread mcl
Why can I not the change the value of a variable in another class, when I have passed it via a parameter list. I am sure I am being stupid, but I thought passed objects were Read/ Write eg #!/usr/bin/python class one(): #my Global

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Matt Nordhoff
mcl wrote: Why can I not the change the value of a variable in another class, when I have passed it via a parameter list. I am sure I am being stupid, but I thought passed objects were Read/ Write In Python, there are names which are bound to objects. Doing foo = bar and then foo = spam

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Jeff
When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function. Python passes function parameters by value. The function will not destructively modify its arguments; you must expliticly state your intention to modify an object: class one(): fred

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread mcl
On 7 Jul, 13:09, Jeff [EMAIL PROTECTED] wrote: When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function.  Python passes function parameters by value.  The function will not destructively modify its arguments; you must expliticly state your

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Matt Nordhoff
mcl wrote: On 7 Jul, 13:09, Jeff [EMAIL PROTECTED] wrote: When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function. Python passes function parameters by value. The function will not destructively modify its arguments; you must expliticly

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Jerry Hill
On Mon, Jul 7, 2008 at 7:30 AM, mcl [EMAIL PROTECTED] wrote: I did not think you had to make the distinction between 'byvar' and 'byref' as in Basic. Python does not use call by value or call by reference semantics. Instead, python's model is call by object. See this writeup for some details:

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Peter Pearson
On Mon, 7 Jul 2008 05:41:22 -0700 (PDT), mcl [EMAIL PROTECTED] wrote: [snip] My use of classes is because I want two classes one for global variables and one for global functions. One of the many lovely things about programming in the Python style is that very few things need to be global.

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Matt Nordhoff
Jerry Hill wrote: On Mon, Jul 7, 2008 at 7:30 AM, mcl [EMAIL PROTECTED] wrote: I did not think you had to make the distinction between 'byvar' and 'byref' as in Basic. Python does not use call by value or call by reference semantics. Instead, python's model is call by object. See this

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread mcl
On Jul 7, 5:07 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Mon, 7 Jul 2008 05:41:22 -0700 (PDT), mcl [EMAIL PROTECTED] declaimed the following in comp.lang.python: My use of classes is because I want two classes one for  global variables and one for global functions.         Which

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Terry Reedy
Jeff wrote: When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function. Python passes function parameters by value. These statements are both wrong. Function argument objects or objects derived therefrom are bound to function parameter

Re: Newbie question about tuples and list comprehensions

2008-06-26 Thread Peter Otten
idiolect wrote: On Jun 25, 7:26 pm, Terry Reedy [EMAIL PROTECTED] wrote: idiolect wrote: Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band

Newbie question about tuples and list comprehensions

2008-06-25 Thread idiolect
Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band value per pixel, and set it to something else if it meets or falls below a certain threshold - i.e

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread Matimus
On Jun 25, 2:37 pm, idiolect [EMAIL PROTECTED] wrote: Hi all - Sorry to plague you with another newbie question from a lurker.  Hopefully, this will be simple. I have a list full of RGB pixel values read from an image.  I want to test each RGB band value per pixel, and set it to something

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread John Machin
On Jun 26, 7:37 am, idiolect [EMAIL PROTECTED] wrote: Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band value per pixel, and set it to something

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread Roger Miller
First, I second Matt's comment about using a boring old for loop when it is the simplest way to express what you want to do. Being Pythonic is not about using exotic features to scrunch your code down to a cool one-liner. It is about expressing your intentions in a simple, direct way. Sometimes

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread Terry Reedy
idiolect wrote: Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band value per pixel, and set it to something else if it meets or falls below a certain

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread idiolect
On Jun 25, 7:26 pm, Terry Reedy [EMAIL PROTECTED] wrote: idiolect wrote: Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band value per pixel

Re: Newbie question about tuples and list comprehensions

2008-06-25 Thread William McBrine
On Wed, 25 Jun 2008 16:02:52 -0700, John Machin wrote: Here's one approach (requires Python 2.5 or later): [(50 if x 50 else x, 50 if y 50 else y, 50 if z 50 else z) for (x, y, z) in source] [(max(x, 50), max(y, 50), max(z, 50)) for (x, y, z) in source] -- 09 F9 11 02 9D 74 E3 5B D8 41

Re: newbie question: for loop within for loop confusion

2008-06-17 Thread Gabriel Genellina
En Mon, 16 Jun 2008 22:51:30 -0300, John Salerno [EMAIL PROTECTED] escribió: takayuki wrote: I'm early on in my python adventure so I'm not there yet on the strip command nuances.I'm reading How to think like a python programmer first. It's great. Then Learning python. I've read

Re: newbie question: for loop within for loop confusion

2008-06-17 Thread John Salerno
Gabriel Genellina wrote: En Mon, 16 Jun 2008 22:51:30 -0300, John Salerno [EMAIL PROTECTED] escribió: takayuki wrote: I'm early on in my python adventure so I'm not there yet on the strip command nuances.I'm reading How to think like a python programmer first. It's great. Then Learning

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread Paul Hankin
On Jun 16, 2:35 pm, takayuki [EMAIL PROTECTED] wrote: def hasnolet2(avoid):         fin = open('animals.txt')         for line in fin:                 word = line.strip()         length = len(avoid)         x = 0         noprint = 0         while length -1 = x:                 if

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread John Salerno
takayuki [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John: There were two inchworms because c is in inchworm so it shouldn't print. Thanks for your detailed description of the for loop. lol, I even sat there looking at the word and said to myself ok, it doesn't contain any of

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread John Salerno
takayuki [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] fin = open('animals.txt') for line in fin: You can write this as: for line in open('animals.txt'): #do stuff Of course, you can't explicitly close the file this way, but that probably doesn't matter. Another way, I

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread MRAB
On Jun 16, 7:17 am, Paul Hankin [EMAIL PROTECTED] wrote: On Jun 16, 2:35 pm, takayuki [EMAIL PROTECTED] wrote: def hasnolet2(avoid): fin = open('animals.txt') for line in fin: word = line.strip() length = len(avoid) x = 0

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread Thomas Hill
On Jun 15, 6:23 pm, takayuki [EMAIL PROTECTED] wrote: def hasnolet(avoid): fin = open('animals.txt') for line in fin: word = line.strip() for letter in avoid: if letter in word: break

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread Thomas Hill
On Jun 16, 2:34 pm, Thomas Hill [EMAIL PROTECTED] wrote: On Jun 15, 6:23 pm, takayuki [EMAIL PROTECTED] wrote: def hasnolet(avoid): fin = open('animals.txt') for line in fin: word = line.strip() for letter in avoid:

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread takayuki
Paul, Thank you for the informative reply. Yes, I created the indent problem when manually copying the original script when I posted. (I'm using an old laptop to study python and posting here using the desktop.) Your examples really helped. Last night I played with using a for loop instead of

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread takayuki
On Jun 17, 6:34 am, Thomas Hill [EMAIL PROTECTED] wrote: On Jun 15, 6:23 pm, takayuki [EMAIL PROTECTED] wrote: def hasnolet(avoid): fin = open('animals.txt') for line in fin: word = line.strip() for letter in avoid:

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread John Salerno
takayuki wrote: I'm early on in my python adventure so I'm not there yet on the strip command nuances.I'm reading How to think like a python programmer first. It's great. Then Learning python. I've read parts of Dive into Python and will work through it fully when I'm a little farther

Re: newbie question: for loop within for loop confusion

2008-06-16 Thread David
takayuki wrote: Paul, Thank you for the informative reply. Yes, I created the indent problem when manually copying the original script when I posted. (I'm using an old laptop to study python and posting here using the desktop.) Your examples really helped. Last night I played with using a

newbie question: for loop within for loop confusion

2008-06-15 Thread takayuki
Hi, I'm studying python via the exellent book How to think like a python programmer by Allen Downey. Noob question follows... animals.txt is a list of animals, each on a separate line: aardvard, bat, cat, dog, elephant, fish, giraffe, horse, insect, jackelope I want to loop through the list of

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread Roy Smith
In article [EMAIL PROTECTED], takayuki [EMAIL PROTECTED] wrote: Hi, I'm studying python via the exellent book How to think like a python programmer by Allen Downey. Noob question follows... animals.txt is a list of animals, each on a separate line: aardvard, bat, cat, dog, elephant,

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread TheSaint
On 09:23, lunedì 16 giugno 2008 takayuki wrote: word = line.strip() Try word= line.split() and at the end of the loop add one more print to go to new line. -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread John Salerno
takayuki wrote: for letter in avoid: if letter in word: break else: print word Take the word 'dog', for example. What the above loop is doing is basically this:

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread John Salerno
takayuki wrote: inchworm inchworm P.S. Why does 'inchworm' only print twice? Or is that not the full output? -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread takayuki
Thanks to everyone for the excellent advice. Roy: I did as you suggested and could see after staring at the output for awhile what was going on. The print statements really helped to put a little light on things. Yes, I agree that learning to fish is the best way. John: There were two

Re: UnicodeEncodeError while reading xml file (newbie question)

2008-06-08 Thread nikosk
You won't believe how helpful your reply was. I was looking for a problem that did not exist. You wrote : (3) why you think you need to have data.decode(.) at all and after that : (7) are you expecting non-ASCII characters after H_C= ? what characters? when you open your xml file in a

Re: Newbie question, list comprehension

2008-06-08 Thread Mark Wooding
Johannes Bauer [EMAIL PROTECTED] wrote: import time localtime = time.localtime(1234567890) fmttime = %04d-%02d-%02d %02d:%02d:%02d % (localtime[0], localtime[1], localtime[2], localtime[3], localtime[4], localtime[5]) print fmttime fmttime = %04d-%02d-%02d %02d:%02d:%02d % ([localtime[i]

Re: Newbie question, list comprehension

2008-06-07 Thread Larry Bates
Johannes Bauer wrote: Hello group, I'm currently doing something like this: import time localtime = time.localtime(1234567890) fmttime = %04d-%02d-%02d %02d:%02d:%02d % (localtime[0], localtime[1], localtime[2], localtime[3], localtime[4], localtime[5]) print fmttime For the third line

UnicodeEncodeError while reading xml file (newbie question)

2008-06-07 Thread nikosk
I just spent a whole day trying to read an xml file and I got stuck with the following error: Exception Type: UnicodeEncodeError Exception Value:'charmap' codec can't encode characters in position 164-167: character maps to undefined Exception Location:

Re: UnicodeEncodeError while reading xml file (newbie question)

2008-06-07 Thread John Machin
On Jun 8, 10:12 am, nikosk [EMAIL PROTECTED] wrote: I just spent a whole day trying to read an xml file and I got stuck with the following error: Exception Type: UnicodeEncodeError Exception Value:'charmap' codec can't encode characters in position 164-167: character maps to

Newbie question, list comprehension

2008-06-06 Thread Johannes Bauer
Hello group, I'm currently doing something like this: import time localtime = time.localtime(1234567890) fmttime = %04d-%02d-%02d %02d:%02d:%02d % (localtime[0], localtime[1], localtime[2], localtime[3], localtime[4], localtime[5]) print fmttime For the third line there is, I suppose, some

Re: Newbie question, list comprehension

2008-06-06 Thread Hans Nowak
Johannes Bauer wrote: Hello group, I'm currently doing something like this: import time localtime = time.localtime(1234567890) fmttime = %04d-%02d-%02d %02d:%02d:%02d % (localtime[0], localtime[1], localtime[2], localtime[3], localtime[4], localtime[5]) print fmttime For the third line

Re: Newbie question, list comprehension

2008-06-06 Thread Johannes Bauer
Hans Nowak schrieb: In this case, you can just use a slice, as localtime is a tuple: fmttime = %04d-%02d-%02d %02d:%02d:%02d % localtime[:6] Hope this helps! ^_^ Ahh, how cool! That's *exactly* what I meant with awesome Python magic :-) Amazing language, I have to admit. Regards,

soaplib newbie question

2008-06-05 Thread Jon Hune
hi everyone, I'm totally new to SOAP. Can anyone help with this soap question. I'm trying to use soaplib. I can't find many examples on using soaplib and what I have below if the standard hello world example I find online. Say I want to call the zzz service at yyy. I know that the service

Re: Newbie Question: How to use a .pth file on a Macintosh

2008-05-25 Thread martin . laloux
you put your pth file in (same configuration: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Question: How to use a .pth file on a Macintosh

2008-05-25 Thread Ivan Illarionov
Robbie wrote: I can't seem to figure out where to put this file so that Python will recognize it when I start it up. You need to put this file in your site-packages directory. To get the location of your site-packages directory, type in Python interactive shell: from distutils.sysconfig

Newbie Question: How to use a .pth file on a Macintosh

2008-05-24 Thread Robbie
Hello All, Hopefully this is an easy question: I'd like to use a .pth file on my Macintosh so that I can easily import modules that I've created in my own working directory. I've created a file called Robbie.pth. It includes a single line: /Robbie/PythonWork I can't seem to figure out where

Re: Newbie Question: How to use a .pth file on a Macintosh

2008-05-24 Thread J Peyret
Hmmm, for lack of a better response, here are some suggestions, based on what I've seen on Windows+Linux. #1 put the .pth in the site-packages directory (this is what I do on Linux). I think Python considers it special and looks for pth. you can probably get that directory from doing import

Re: Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-06 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : Banibrata Dutta [EMAIL PROTECTED] wrote: I've gone through the list of language differences between 2.3 / 2.4 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider myself still very very newbie. So, unable to take a call as to

Re: Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-06 Thread Banibrata Dutta
On 5/6/08, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Nick Craig-Wood a écrit : Banibrata Dutta [EMAIL PROTECTED] wrote: I've gone through the list of language differences between 2.3 / 2.4 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider

Re: Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-06 Thread cokofreedom
2.5 seems the defacto standard now for a new user, NB: probably not the standard for the common business productions. However are you on Windows or *nix? *nix may ship a certain version, so for ease of use it would be best to use that. Personally I use 2.5 because it is a complete version, and

Re: Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-06 Thread Nick Craig-Wood
Banibrata Dutta [EMAIL PROTECTED] wrote: As such 2.6 3.0 are also cooking, but from what I see on the mailing list, some of the features are a bit controversial. So if I start with 2.5 now, unless there are some break-thru preformance gains, or annoying defects fixed, I'd stick to it. If

Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-03 Thread Banibrata Dutta
Hi, I've gone through the list of language differences between 2.3 / 2.4 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider myself still very very newbie. So, unable to take a call as to how-important or desirable the newer language features are -- so whether

Re: Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-03 Thread Nick Craig-Wood
Banibrata Dutta [EMAIL PROTECTED] wrote: I've gone through the list of language differences between 2.3 / 2.4 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider myself still very very newbie. So, unable to take a call as to how-important or desirable

Re: Newbie question about import

2008-04-27 Thread Luca
On Sat, Apr 26, 2008 at 4:14 AM, Gabriel Genellina [EMAIL PROTECTED] wrote: The short answer is: don't do that! __init__.py may import any module, but other modules in the package should not import anything from __init__.py The same rule applies to the main module in an application: it can

Newbie question about import

2008-04-25 Thread Luca
Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called mommy.py * a __version__ var defined inside the main __init__.py From the

Re: Newbie question about import

2008-04-25 Thread Larry Bates
Luca wrote: Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called mommy.py * a __version__ var defined inside the main __init__.py

Re: Newbie question about import

2008-04-25 Thread Kay Schluehr
On 25 Apr., 20:03, Luca [EMAIL PROTECTED] wrote: Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called mommy.py * a __version__

newbie question

2008-04-25 Thread JMysak
I'm working with the HTMLParser module and have implemented HTMLParser.handle_starttag() and I see there is a separate handle_data method (which can be implemented), but I am not clear how to tie this together with a given start tag, so I only get the data I want. For example, I'd like to get a

newbie question

2008-04-25 Thread John
I'm working with the HTMLParser module and have implemented HTMLParser.handle_starttag() and I see there is a separate handle_data method (which can be implemented), but I am not clear how to tie this together with a given start tag, so I only get the data I want. For example, I'd like to get a

Re: newbie question

2008-04-25 Thread Gabriel Genellina
En Fri, 25 Apr 2008 19:35:58 -0300, John [EMAIL PROTECTED] escribió: I'm working with the HTMLParser module and have implemented HTMLParser.handle_starttag() and I see there is a separate handle_data method (which can be implemented), but I am not clear how to tie this together with a given

Re: Newbie question about import

2008-04-25 Thread Gabriel Genellina
En Fri, 25 Apr 2008 15:03:18 -0300, Luca [EMAIL PROTECTED] escribió: Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called

Re: newbie question

2008-04-25 Thread John
Thanks for the tip! -- http://mail.python.org/mailman/listinfo/python-list

<    2   3   4   5   6   7   8   9   10   11   >