In windows ,I tried this
p1 = C:\Users\me\Documents
p2 = ..\Pictures\images\my.jpg
print os.path.join(p1,p2)
This gives
'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg'
I expected I would get
'C:\\Users\\me\\Pictures\\images\\my.jpg'
I thought os.path.join would join the paths more
In imaplib.IMAP4.search() the search string SENTON can be used
'(SENTON 22-Jun-2010)' .
But the RFC 2060 defines search key as
SENTON date Messages whose [RFC-822] Date: header is within the
specified date.
and in RFC822 it is given as,
date= 1*2DIGIT month 2DIGIT
Hi
In the signature of of imaplib.status() method
MAP4.status(mailbox, names)
why is the 'names ' argument plural?Can I pass more than one name to
the method?
I can get correct result when I call,
imapclient.status('Inbox', (UNSEEN))
or
imapclient.status('Inbox', (RECENT))
Is it possible to
hi
I am trying to write a compare method which takes two strings and find
how many characters have changed.
def compare_strings(s1,s2):
pass
text1=goat milk
text2=cow milk
print compare_strings(text1,text2)
This must give 3 ,since 3 characters are changed between strings.I was
advised to
On Oct 9, 2:45 pm, Peter Otten __pete...@web.de wrote:
What would be an acceptable time?
Thanks for the reply Peter,
I was using python functions I came across the net..not cpython
implementations..Probably my low config machine is also to blame..(I
am no expert at judging algorithm
On Oct 9, 4:52 pm, Peter Otten __pete...@web.de wrote:
You might get more/better answers if you tell us more about the context of
the problem and add some details that may be relevant.
Peter
I am trying to determine if a wep page is updated by x number of
characters..Mozilla firefox plugin
On Oct 9, 5:41 pm, Stefan Behnel stefan...@behnel.de wrote:
Number of characters sounds like a rather useless measure here.
What I meant by number of characters was the number of edits happened
between the two versions..Levenshtein distance may be one way for
this..but I was wondering if
hi
I am trying to write a DataGrabber which reads some data from given
url..I made DataGrabber as a Thread and want to wait for some interval
of time in case there is a network failure that prevents read().
I am not very sure how to implement this
class DataGrabber(threading.Thread):
def
hi
I have been trying out singleton design pattern implementations..I
wrote this,
class Singleton(object):
_instance = None
def __new__(self, *args, **kwargs):
if not self._instance:
self._instance = super(Singleton, self).__new__(self,
*args, **kwargs)
return
thanks Steven..that was very helpful..thanks a lot
harry
Since __new__ is called before the instance exists, it doesn't receive an
instance as the first argument. Instead it receives the class. While you
can call the parameter anything you like, it is conventional to call it
cls rather than
thanks Arnold..that made it quite clear
harry
On Oct 3, 4:11 pm, Arnaud Delobelle arno...@gmail.com wrote:
Arnaud Delobelle arno...@gmail.com writes:
--
http://mail.python.org/mailman/listinfo/python-list
hi
I am trying to write a program to read data from a site url.
The program must read the data from site every 5 minutes.
def get_data_from_site(pageurlstr):
h=urllib.urlopen(pageurlstr)
data=h.read()
process_data(data)
At first, I thought of using the sched module ,but then it
thanks Frank
Here is a technique that allows the loop to run in the background, in its
own thread, leaving the main program to do other processing -
import threading
class DataGetter(threading.Thread):
--
http://mail.python.org/mailman/listinfo/python-list
hi
I posted this question in ubuntu users forum but no help was
forthcoming..
I hope someone can help me here.
I had been using jaunty as o.s and was coding in python 2.6. While
using Tix widgets in my code I came across a bug as mentioned in
hi
I have 2 lists of numbers,say
x=[2,4,3,1]
y=[5,9,10,6]
I need to create another list containing
z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6]
I did not want to use numpy or any Array types.I tried to implement
this in python .I tried the following
z=[]
for a,b in zip(x,y):
z.append(a*b)
On Sep 20, 7:28 pm, Bruno wrote:
A list comp comes to mind, as well as using itertools.izip
thanks Bruno,thanks Gary..
Should have thought of list comprehension..
Thanks for the pointer about izip
harry
--
http://mail.python.org/mailman/listinfo/python-list
hi
I was going thru the weblog appln in practical django book by
bennet .I came across this
class Entry(Model):
def save(self):
dosomething()
super(Entry,self).save()
I couldn't make out why Entry and self are passed as arguments to super
().Can someone
thanks Simon..I should have checked it
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 18, 11:10 pm, Scott David Daniels scott.dani...@acm.org
Are you running F:\Python25\python.exe (or F:\Python25\pythonw.exe)?
open a command window (run cmd), and type:
C:\ python
...
import sys
for dirname in sys.path:
print sys.path
I suspect
hi
Is there a way to list all the installed modules in my python
installation.I recently installed pygame and when i tried to import it
like
import pygame
it complained that no such module was found.I can see the pygame
directory in F:\Python25\Lib\site-packages in my machine,but am unable
to
On Feb 18, 9:42 pm, Peter Otten __pete...@web.de wrote:
help(modules)
thanks Peter.That helped.
Regarding the original problem, do you have multiple Python installations?
If so, you may accidentally be running the wrong python.
I have only one installation.It shows all other modules.I will
hi
i have seen some class definitions like
class MyClass(object):
def __init__(self):
what does the object keyword inside the braces in MyClass() mean?
Has it got any significance?
thanks in advance
harry
--
http://mail.python.org/mailman/listinfo/python-list
hi
i am trying to display an image on a canvas in a gui made with Tkinter
widgets
class PhotoDisplay:
def __init__(self,parent):
self.mainframe = Frame(parent,background=grey)
.
#added a subframe to hold canvas and button
The code is pretty legible as it is now. Anyway, using min() and a
generator:
hi
is this calculated distance really Euclidean distance? When i checked
wikipedia http://en.wikipedia.org/wiki/Euclidean_distance
it shows a calculation involving sum of squares of the differences of
elements.Here
the norm from which it is derived is called norm-1, or L1; the usual
euclidean distance is derived from norm-2.
If you only want to see if two things are close enough, this provides a
faster measure than the euclidean distance.
thanks Gabriel for the detailed explanation..
if i were to
hi all
I am new to python and learning PCA method by reading up TurkPetland
papers etc
while trying out PCA on a set of greyscale images using python, and
numpy I tried to create eigenvectors and facespace.
i have
facesarray--- an NXP numpy.ndarray that contains data of images
N=numof
Paul McGuire wrote
# following approx fromhttp://www.dfanning.com/ip_tips/color2gray.html
grayscale = lambda (R,G,B) : int(0.3*R + 0.59*G + 0.11*B)
print [ [ grayscale(rgb) for rgb in row ] for row in sampledata ]
Paul
in PIL handbook ,they mention a Luma transform on page15, under the
27 matches
Mail list logo