Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 19th, 2004, 10:47 AM
wrecher wrecher is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 7 wrecher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Is Python up to the task?

Im going to be starting out a new project and i just wanna know if python will beable to handle my needs.

1. Beable to parse a line of text for keywords.
2. Enter the keywords if found into a database (prob. mySQL)
3. do this in upwards of 100lines per seconds.

Ofcourse the project will be more complex than this but thats the basics. The input source wont be static like a text file or anything thats why its important that it can handle if theres a sudden burst.
I wont be need a gui or anything, it will be ran on linux so all im going to do is have a text output when ever i type the command to get one.

Last edited by wrecher : November 19th, 2004 at 10:56 AM. Reason: spelling

Reply With Quote
  #2  
Old November 19th, 2004, 04:55 PM
idologic_aw's Avatar
idologic_aw idologic_aw is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: London, ON, Canada, eh
Posts: 127 idologic_aw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 11 m 42 sec
Reputation Power: 6
Not sure how to do this with python but it would be easy in tcl/tk.

1. foreach keyword $keywords {
set kw [lsearch $line_of_text $keyword]
}
2. catch {
eval exec <external linux command> $keyword
}
3. Of course this'll depend on your system but I believe one
tcl/tk call is equivalent to 3 C calls.

I managed to read 661 lines from a text in under a second.

Quote:
Originally Posted by wrecher
Im going to be starting out a new project and i just wanna know if python will beable to handle my needs.

1. Beable to parse a line of text for keywords.
2. Enter the keywords if found into a database (prob. mySQL)
3. do this in upwards of 100lines per seconds.

Ofcourse the project will be more complex than this but thats the basics. The input source wont be static like a text file or anything thats why its important that it can handle if theres a sudden burst.
I wont be need a gui or anything, it will be ran on linux so all im going to do is have a text output when ever i type the command to get one.

Reply With Quote
  #3  
Old November 19th, 2004, 06:34 PM
sfb sfb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 447 sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 1 h 43 m 45 sec
Reputation Power: 10
Quote:
1. Beable to parse a line of text for keywords.

What does "parsing a line for keywords" consist of?

Quote:
3. do this in upwards of 100lines per seconds.

How long is a line?
How fast is the computer?
What else is it doing besides running this script?
Is the DB on the same machine or accessed over a network?
Do you need things like transactions for each DB insert?

Basically, I think you should try it.
(not real working code).
Code:
import stuff

db = connect_to_db('details, username, password')
cursor = db.getCursor()
fin = open("test_file", "rb")

for line in fin:
    result = test_search_for_keywords(line)
    if result:
        cursor.execute("insert into table values (?,?)", result)

Reply With Quote
  #4  
Old November 20th, 2004, 04:45 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,254 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 8 h 9 m
Reputation Power: 265
I am sure Python is up to the job, although as sfb pointed out there are a lot of unknowns.

The bottleneck in a task like this is almost certainly going to be the database access, so the speed of the language will be largely irrelevant.

Dave - The Developers' Coach

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Is Python you to the task?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT