On May 24, 11:47 am, Hans Müller wrote:
> Try this:
>
> print "\\"
>
> \ is the escape character, it masks the meaning of the next chararcter.
>
> If you write print "\" python tries to print " (the meaning of " as
> the string delimiter is beeing masked) and finds no closing "
> This is why you g
How come something like '\' causes an error? Here is what I mean.
[cdal...@localhost ~]$ python
Python 2.6.2 (r262:71600, May 3 2009, 17:04:44)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "test \"
File "", l
On May 9, 8:36 am, Piet van Oostrum wrote:
> >>>>> grocery_stocker (gs) wrote:
> >gs> The following code gets data from 5 different websites at the "same
> >gs> time".
> >gs> #!/usr/bin/python
> >gs> import Queue
> >gs&g
The following code gets data from 5 different websites at the "same
time".
#!/usr/bin/python
import Queue
import threading
import urllib2
import time
hosts = ["http://yahoo.com";, "http://google.com";, "http://amazon.com";,
"http://ibm.com";, "http://apple.com";]
queue = Queue.Queue()
On May 3, 1:40 pm, "Diez B. Roggisch" wrote:
> grocery_stocker schrieb:
>
>
>
> > On May 3, 1:16 pm, "Diez B. Roggisch" wrote:
> >> grocery_stocker schrieb:
>
> >>> Let's say there is a new zip file with updated information every
On May 3, 1:16 pm, "Diez B. Roggisch" wrote:
> grocery_stocker schrieb:
>
> > Let's say there is a new zip file with updated information every 30
> > minutes on a remote website. Now, I wanna connect to this website
> > every 30 minutes, download the
Let's say there is a new zip file with updated information every 30
minutes on a remote website. Now, I wanna connect to this website
every 30 minutes, download the file, extract the information, and then
have the program search the file search for certain items.
Would it be better to use threads
On May 2, 4:14 am, Sebastian Wiesner wrote:
> > I don't understand your objection. Is it that the
> documentation calls it
> > Request instead of urllib2.Request? Or that it calls it an object instead
> > of an instance?
>
> I guess the latter ...
>
> > In either case, I think you're picking a ni
At the following url...
http://docs.python.org/library/urllib2.html
They have the following...
"urllib2.urlopen(url[, data][, timeout])
Open the URL url, which can be either a string or a Request
object"
I don't get how urllib2.urlopen() can take a Request object. When I do
the following..
On Apr 27, 5:15 am, Peter Otten <__pete...@web.de> wrote:
> psaff...@googlemail.com wrote:
> > I'm using the CSV library to process a large amount of data - 28
> > files, each of 130MB. Just reading in the data from one file and
> > filing it into very simple data structures (numpy arrays and a
> >
On Apr 26, 2:07 pm, Arnaud Delobelle wrote:
> grocery_stocker writes:
> > When I do pexpect.spawn in the following example, I see > 'pexpect.spawn'>
>
> > [cdal...@localhost oakland]$ python
> > Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
> > [GC
When I do pexpect.spawn in the following example, I see
[cdal...@localhost oakland]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
>>> pexpect.spawn
>>>
Given the following...
[cdal...@localhost oakland]$ more basic.py
#!/usr/bin/python
import sched
import time
scheduler = sched.scheduler(time.time, time.sleep)
def print_event(name):
print 'EVENT:', time.time(), name
print 'START:', time.time()
scheduler.enter(2, 1, print_event, ('firs
On Apr 23, 3:29 pm, Chris Rebert wrote:
> On Thu, Apr 23, 2009 at 3:21 PM, grocery_stocker wrote:
> > Say I have a script that fetches data from a website every hour. Is
> > there a general solution or is the solution operating system specific?
>
> WRT the periodic operat
Say I have a script that fetches data from a website every hour. Is
there a general solution or is the solution operating system specific?
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 21, 3:39 pm, Benjamin Edwards
wrote:
> On Apr 21, 11:10 pm, grocery_stocker wrote:
>
> > Let's say that I have a file with the following words
> > shirt
> > jeans
> > belt
> > jacket
>
> > Now I want to be able to enter these words int
Let's say that I have a file with the following words
shirt
jeans
belt
jacket
Now I want to be able to enter these words into the search function at
the following website..
http://oldnavy.gap.com/?redirect=true
Is there some method in the urllib method that would allow me to do
this? I tried goo
I'm just really not seeing how something like x63 and/or x61 gets
converted by 'print' to the corresponding chars in the following
output...
[cdal...@localhost oakland]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "cre
On Apr 16, 11:46 am, Piet van Oostrum wrote:
> >>>>> grocery_stocker (g) wrote:
> >g> [cdal...@localhost ~]$ python
> >g> Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
> >g> [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
> >g> Type "help
On Apr 16, 4:12 am, Rüdiger Ranft <_r...@web.de> wrote:
> Hi all,
>
> I need to call some programms and catch their stdout and stderr streams.
> While the Popen class from subprocess handles the call, I get the
> results of the programm not until the programm finishes. Since the
> output of the pro
I don't get how item = self.__queue.get() gets advanced to
if item is None:
in the following code.
>>> import time
>>> from threading import Thread
>>> import Queue
>>>
>>> WORKER = 2
>>>
>>> class Worker(Thread):
... def __init__(self, queue):
... Thread.__init__(self)
...
What's the difference between doing something calling A.__init__(self)
like in the following...
[cdal...@localhost ~]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class
On Apr 10, 8:39 am, Peter Otten <__pete...@web.de> wrote:
> grocery_stocker wrote:
> > On Apr 10, 6:48 am, Peter Otten <__pete...@web.de> wrote:
> >> grocery_stocker wrote:
> >> > When I run the following...
>
> >> > #!/usr/bin/pytho
On Apr 10, 6:48 am, Peter Otten <__pete...@web.de> wrote:
> grocery_stocker wrote:
> > When I run the following...
>
> > #!/usr/bin/python
>
> > import time
> > import thread
> > import threading
>
> > def get_first_part(strin
When I run the following...
#!/usr/bin/python
import time
import thread
import threading
def get_first_part(string, lock, sleeptime, *args):
global counter
lock.acquire()
try:
counter = counter + 1
data = counter
print "%s v
On Apr 9, 7:01 pm, grocery_stocker wrote:
> On Apr 9, 6:36 pm, grocery_stocker wrote:
>
> > Given the following
>
> > #!/usr/local/bin/python
>
> > import os
> > import time
> > import thread
>
> > def domsg(string, sleeptime, *args):
>
On Apr 9, 6:36 pm, grocery_stocker wrote:
> Given the following
>
> #!/usr/local/bin/python
>
> import os
> import time
> import thread
>
> def domsg(string, sleeptime, *args):
> print "%s was here", string
> #os.system('tel %s test&
Given the following
#!/usr/local/bin/python
import os
import time
import thread
def domsg(string, sleeptime, *args):
print "%s was here", string
#os.system('tel %s test' % person);
#time.sleep(sleeptime)
def buildlist():
out = 1
persons = []
while(out != 0):
Given the following
[cdal...@localhost ~]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def counter():
... mylist = range(3)
... for i in mylist:
... yield i*i
.
On Apr 2, 6:33 pm, "Rhodri James" wrote:
> On Fri, 03 Apr 2009 02:07:38 +0100, grocery_stocker
> wrote:
>
> > Okay, I was thinking more about this. I think this is also what is
> > irking me. Say I have the following..
>
> >>>> a = [1,2,3,4]
>
On Apr 2, 4:41 pm, "andrew cooke" wrote:
> Robert Kern wrote:
> >> replace return with yield and it might work.
>
> >> i have to go eat, but if it doesn't read the python docs on iterators -
> >> for examplehttp://docs.python.org/reference/expressions.html#index-1825
>
> > No, .next() needs to be
>
> in summary: iterator is bound to one instance of "it", while some_func()
> returns a new instance each time it is called.
>
> BUT
>
> while what you are doing is interesting, it is not the same as Python's
> iterators, which use "yield" from a function and don't require storing a
> value in a
On Apr 2, 3:14 pm, grocery_stocker wrote:
> Give the following code..
>
> >>> class it:
>
> ...def __init__(self):
> ...self.count = -1
> ...def next(self):
> ...self.count +=1
> ...if self.count < 4:
> ...
Give the following code..
>>> class it:
...def __init__(self):
...self.count = -1
...def next(self):
...self.count +=1
...if self.count < 4:
...return self.count
...else:
...raise StopIteration
...
>>> def some_func():
... return
On Mar 25, 8:28 am, Tim Chase wrote:
> grocery_stocker wrote:
> > On Mar 25, 7:05 am, grocery_stocker wrote:
> >> Given the following code...
>
> >> #!/usr/bin/env python
>
> >> import time
> >> import thread
>
> >> def myfunction(
On Mar 25, 7:05 am, grocery_stocker wrote:
> Given the following code...
>
> #!/usr/bin/env python
>
> import time
> import thread
>
> def myfunction(string,sleeptime,*args):
> while 1:
>
> print string
> time.sleep(sleeptime) #sleep fo
Given the following code...
#!/usr/bin/env python
import time
import thread
def myfunction(string,sleeptime,*args):
while 1:
print string
time.sleep(sleeptime) #sleep for a specified amount of time.
if __name__=="__main__":
thread.start_new_thread(myfunction,("Thread N
Taken from the url
http://openbookproject.net/thinkCSpy/ch05.xhtml#index15
"The built-in functions we have used, such as abs,
pow, and max, have produced results. Calling each of
these functions generates a value, which we usually assign to a
variable or
use as part of an expression.
bigge
On Mar 21, 10:03 am, Tim Chase wrote:
> >>>transitions = {
> >>> # values are tuples of (newstate, transition_function)
> >>> STATE_A: [
> >>>(STATE_B, lambda x: x > 5),
> >>>(STATE_C, lambda x: x > 10),
> >>>(STATE_D, lambda x: x > 100),
> >>>],
> >>>
On Mar 21, 8:47 am, grocery_stocker wrote:
> On Mar 21, 6:38 am, Tim Chase wrote:
>
>
>
> > > For example, this means that there can be a start node supposedly.
> > > Having a value of 0. It is pointing to node 1 with the value of "a"
> > > an
On Mar 21, 6:38 am, Tim Chase wrote:
> > For example, this means that there can be a start node supposedly.
> > Having a value of 0. It is pointing to node 1 with the value of "a"
> > and to node 2 with the value of "b". Trying to make something like an
> > NFA. Where id be changing regular expres
On Mar 21, 8:21 am, Kushal Kumaran wrote:
> On Mar 21, 7:55 pm, grocery_stocker wrote:
>
> > Given the following
>
> > def double(val):
> > return val.bind(lambda x: val.return_(x*2))
>
> > I get "AttributeError: 'int' object has no at
On Mar 21, 8:11 am, John Machin wrote:
> On Mar 22, 1:55 am, grocery_stocker wrote:
>
>
>
> > Given the following
>
> > def double(val):
> > return val.bind(lambda x: val.return_(x*2))
>
> > I get "AttributeError: 'int' object has
Given the following
def double(val):
return val.bind(lambda x: val.return_(x*2))
I get "AttributeError: 'int' object has no attribute 'bind' " when I
try to do the following
double(2)
Below is the output...
[cdal...@localhost ~]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.
On Mar 20, 5:08 pm, grocery_stocker wrote:
> On Mar 20, 8:34 am, Paul McGuire wrote:
>
> > On Mar 20, 9:54 am, "thomasvang...@gmail.com"
>
> > wrote:
> > > You could use:
> > > B=list(set(A)).sort()
> > > Hope that helps.
> > &g
On Mar 20, 8:34 am, Paul McGuire wrote:
> On Mar 20, 9:54 am, "thomasvang...@gmail.com"
>
> wrote:
> > You could use:
> > B=list(set(A)).sort()
> > Hope that helps.
> > T
>
> That may hurt more than help, sort() only works in-place, and does
> *not* return the sorted list. For that you want the
On Mar 17, 3:22 pm, Emile van Sebille wrote:
> grocery_stocker wrote:
>
>
>
>
>
> > It seems like id(list[]) == id().
>
> It might seem that way, but test with other than single-character
> strings, eg lists like [7],[8],[9] and try again.
>
I still get t
Given the following
[cdal...@localhost ~]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> list = [7,8,9]
>>> id(list)
-1209401076
>>> id(list[0])
154303848
>>> id(list[
On Mar 9, 1:33 pm, Bruno Desthuilliers
wrote:
> David Cournapeau a écrit :
>
> > On Mon, Mar 9, 2009 at 11:33 PM, grocery_stocker wrote:
> >> On Mar 9, 5:30 am, Nick Craig-Wood wrote:
> >>> Go here
>
> >>> http://www.diveintopython.org/
>
On Mar 9, 5:30 am, Nick Craig-Wood wrote:
> ZikO wrote:
> > I am a C++ programmer and I am thinking of learning something else
> > because I know second language might be very helpful somehow. I have
> > heard a few positive things about Python but I have never writen any
> > single line in p
On Jul 25, 12:45 pm, [EMAIL PROTECTED] wrote:
> Python is a better language, with php support, anyway, but I am fed up
> with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
> Perl experience for everyone. Instead of being helpful, snide remarks,
> back-biting, scare tactings, and
51 matches
Mail list logo