Re: [Tutor] python and sqlite

2010-02-01 Thread Alan Gauld


Samuel de Champlain samueldechampl...@gmail.com wrote


Here is another short one that I found:
http://www.wdvl.com/Authoring/python/SQLite/Watts07162009.html
If anyone knows of other tutorials on python and sqlite, please tell me 
of

them.


The databases topic in my tutorial uses SQLite as its database engine.
(Only in the v2 tutor so far)
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] parse text file

2010-02-01 Thread spir
On Mon, 1 Feb 2010 00:43:59 +0100
Norman Khine nor...@khine.net wrote:

 but this does not take into account of data which has negative values

just add \-? in front of \d+

Denis


la vita e estrany

http://spir.wikidot.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] parse text file

2010-02-01 Thread Norman Khine
On Mon, Feb 1, 2010 at 10:57 AM, spir denis.s...@free.fr wrote:
 On Mon, 1 Feb 2010 00:43:59 +0100
 Norman Khine nor...@khine.net wrote:

 but this does not take into account of data which has negative values

 just add \-? in front of \d+

thanks, what about the whitespace problem?


 Denis
 

 la vita e estrany

 http://spir.wikidot.com/
 ___
 Tutor maillist  -  tu...@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
% .join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ,adym,*)uzq^zqf ] )
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] One question related to installation of Spyder

2010-02-01 Thread #DENG JUN#
To those it may concern:

 

Hi, I got a problem with installing Spyder. By the way, my desktop is of
windows system. I know that before installing Spyder, I first have to
equip my computer with PyQt4.x(x=4), QScintilla (x=1) and Python2.5
(and upper). Do you have any release of QScintilla in .exe form? I
failed to find the detailed instruction about how to install with the
source file.

 

Best, 

DENG JUN

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] parse text file

2010-02-01 Thread Kent Johnson
On Mon, Feb 1, 2010 at 6:29 AM, Norman Khine nor...@khine.net wrote:

 thanks, what about the whitespace problem?

\s* will match any amount of whitespace includin newlines.

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] parse text file

2010-02-01 Thread Norman Khine
On Mon, Feb 1, 2010 at 1:19 PM, Kent Johnson ken...@tds.net wrote:
 On Mon, Feb 1, 2010 at 6:29 AM, Norman Khine nor...@khine.net wrote:

 thanks, what about the whitespace problem?

 \s* will match any amount of whitespace includin newlines.

thank you, this worked well.

here is the code:

###
import re
file=open('producers_google_map_code.txt', 'r')
data =  repr( file.read().decode('utf-8') )

block = re.compile(ropenInfoWindowHtml\(.*?\\ticon: myIcon\\n)
b = block.findall(data)
block_list = []
for html in b:
namespace = {}
t = re.compile(rstrong(.*)\/strong)
title = t.findall(html)
for item in title:
namespace['title'] = item
u = re.compile(ra href=\\/(.*)\En savoir plus)
url = u.findall(html)
for item in url:
namespace['url'] = item
g = re.compile(rGLatLng\((\-?\d+\.\d*)\,\\n\s*(\-?\d+\.\d*)\))
lat = g.findall(html)
for item in lat:
namespace['LatLng'] = item
block_list.append(namespace)

###

can this be made better?


 Kent

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] query

2010-02-01 Thread Grigor Kolev
В 22:09 + на 31.01.2010 (нд), invincible patriot написа:
 i just don wana index all the characters rather i wana double it too
 like 
 ['d','a','v','i','d']
 would b 
 ['d','dd','a','aa','v','vv','i','ii','d','dd']
 and then i wana replace all non 'd' characters with '.' a dot
 
 i know how replace a specific character, but i don know how to replace
 all characters other than a specific character
 
 
 thanks
 
 
 
  Subject: Re: [Tutor] query
  From: grigor.ko...@gmail.com
  To: invincible_patr...@hotmail.com
  CC: anand.shash...@gmail.com; da...@pythontoo.com; tutor@python.org
  Date: Sun, 31 Jan 2010 23:49:58 +0200
  
  В 21:21 + на 31.01.2010 (нд), invincible patriot написа:
   Hi
   can any one tel me how can i do indexing of individual characters
 in
   python
   like if i hav a word eg david
   a='david'
   b=list(a)
   # this will give ['d','a','v','i','d']
   not i want to print the index of each character
   how can i do that
   please tel me
   
   thanks
   
   
   
  
 __
   Hotmail: Free, trusted and rich email service. Get it now.
   ___
   Tutor maillist - Tutor@python.org
   To unsubscribe or change subscription options:
   http://mail.python.org/mailman/listinfo/tutor
  List indexed by position
  ['d','a','v','i','d']
  0,1,2,3,4,5
  Can index like this
  a[1]
  You can index and string too not need to be a list
  a[1]
  if you want find position of 'a' use this
  a.find('a')
  -- 
  Grigor Kolev grigor.ko...@gmail.com
  
 
 
 __
 Hotmail: Free, trusted and rich email service. Get it now.
Read this 
http://docs.python.org/tutorial/controlflow.html#for-statements
-- 
Grigor Kolev grigor.ko...@gmail.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Algorithm for combined area of circles

2010-02-01 Thread Shashwat Anand
Let there be 'n' circles (upper bound on n = 10**6) each of radius
'1'. We enter their co-ordinates which are floating points and lies
between (-1000, 1000). I need to find area of the resulting figure
formed by intersection of circles.
I came across these links :
http://stackoverflow.com/questions/1667310/combined-area-of-overlapping-circles
http://answers.google.com/answers/threadview?id=480288
http://mathworld.wolfram.com/Circle-CircleIntersection.html
But of no avail. Can anyone point me towards right direction? :(

~Shashwat Anand
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] tracking program

2010-02-01 Thread Luis Ortega
Hello

I am fairly new to programming (which means I have never, ever, ever written
a program).  I have a book or two in Python, and so far I like it.  I have a
stupid question to ask; Is it possible to write an employee's internet
tracking program in Python?

I know I have a long way before I even attempt to code, but could someone
describe what the process would entail?  How would my python program be able
to track an employee as he surfs the net (along with capture IP  time
wasted on the net).

I know that there are programs that can be purchase to do what I 'm trying
to accomplish.  I just will like to write it my self.

Thanks,
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 72, Issue 3

2010-02-01 Thread Carnell, James E


Let there be 'n' circles (upper bound on n = 10**6) each of radius '1'.
We enter their co-ordinates which are floating points and lies between
(-1000, 1000). I need to find area of the resulting figure formed by
intersection of circles. I came across these links :
http://stackoverflow.com/questions/1667310/combined-area-of-overlapping-
circles
http://answers.google.com/answers/threadview?id=480288
http://mathworld.wolfram.com/Circle-CircleIntersection.html
But of no avail. Can anyone point me towards right direction? :(

~Shashwat Anand
===
This is probably spam, but...

1) My bad answer is to render them in pygame et al and do edge
detection, if overlap color pixels a different color then count pixels.
Probably would have to do in parts since the area is so big. Last I knew
edge detection for circles sucks... 

2) My trying to be good answer but is untested and probably doesn't work
(ugh) is to use an FFT on the x and y axis. Numpy  has an FFT. Since
they all have the same circumference then maybe you can just scan to the
left and right on the X axis and on the Y axis compute the difference
and the resulting intersection. Put the intersection in a lookup chart
under a key value for the differences (I think you can sum the x and y
difference maybe not to have less keys). At some point you could
probably just interpolate your lookup chart to save time unless you need
it exact as possible. 

Is this some kind of vision algorithm?

Sincerely,

Bad answer man
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] tracking program

2010-02-01 Thread Wayne Werner
On Mon, Feb 1, 2010 at 1:45 PM, Luis Ortega gow...@gmail.com wrote:

 Hello

 I am fairly new to programming (which means I have never, ever, ever
 written a program).  I have a book or two in Python, and so far I like it.
 I have a stupid question to ask; Is it possible to write an employee's
 internet tracking program in Python?

 I know I have a long way before I even attempt to code, but could someone
 describe what the process would entail?  How would my python program be able
 to track an employee as he surfs the net (along with capture IP  time
 wasted on the net).

 I know that there are programs that can be purchase to do what I 'm trying
 to accomplish.  I just will like to write it my self.



You're right about having quite a while to go... but it's definitely
possible.

Basically, from about a 10,000' view, you would be writing a program to act
as proxy between the web browser and the internet. I suppose at its most
simple, you could write it with fairly few lines of code. The only thing I'm
not sure on how to do is grab the outgoing connection. I presume it would
require some type of loopback device, but I'm not terribly familiar with
sockets/network programming.

The IP part is pretty simple - a simple google search about python resolve
ip address or something to that effect would probably get you good results.

After learning a bit about program flow (i.e. writing a few programs), you
could probably look up python socket programming and come up with some
useful info.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor