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

Go Back   Tutorialized ForumsWeb Design & DevelopmentPython

Add This Thread To:   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
Unread Tutorialized Forums Sponsor:
Old February 5th, 2010, 11:37 PM
chuckiechan chuckiechan is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
Join Date: Feb 2010
Posts: 3 chuckiechan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 23 sec
Reputation Power: 0
Help to make search work

I am new to programing so forgive me if my code is amicher.
I am trying to have the search return several numbers or words in a single sentences. I don't know if I am using the wrong format I am trying to use the split method because I thought I could return several parts of a sentence with it. For example if it had 1 2 3 4 5 I thought I could search and return 1 3 5 or if it had “to set the function” I could return “set function” from that line, but I can’t get it working properly.

I have tried several different approaches with split. I have tried to split it at the raw_input() line, at the if statement, putting it in a loop and declaring it separately.
I have looked up, in the python library to make sure I am entering it properly. It will ether run trough and not work like I expect or it will come up with an error.

I think I am using the right method in the wrong way. If you could tell me if I am trying the correct method or give me a push in the right direction that would be grate thanks.

This is the code I am using less the split() method becaues I cant get it to work.
look_in = raw_input ("Enter the search file to look in ")
search = raw_input ("Enter your search item ")

file = open(look_in, "r").read().count(search)
if file: print search, ",", file,"Of your search was found"
else: print "Your search was not found"

This is what I would like it to do.
Enter your search item 50 150

#example of text in document
April1, 50 100 150 100 200
April2, 100 50 200 50 250
April3, 100 50 150 200 100

2 of your search was found

So it would look for the 50 and 150 in each line then print how many times they are in the same line together in the same order.

Reply With Quote

Viewing: Tutorialized ForumsWeb Design & DevelopmentPython > Help to make search work

Developer Shed Advertisers and Affiliates

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 | 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.

© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap