|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
os.system()
Ok im tring to code this dictionary search program.. but its not fully working for me
from what i see if the url has an = sign then it wont work it will just open a regular explorer window.. now it i was to remove it.. then my progrom works and it will be transferring to the url does anyone knows why??? this only happends on windows.. tested it on linux and works like a charm.. here is the part of my code that its messing up on windows..Code:
search = self.entry.get()
os.system("explorer http://www.google.com/search?sourceid=navclient&q="+search)
:confused:
any idea.. the only problem is the equal sign ![]()
__________________
IE QUOTE | PHP Manual | Google | C/C++ Compiler | Linux Tutorials | General Stuff Game Dev |
|
#2
|
||||
|
||||
|
Mmm
this isnt how i'd choose to get the contents of a webpage X, you should look at the urllib module i.e.Code:
import urllib
param = urllib.urlencode({'sourceid': 'navclient', 'q': seach})
page = urllib.urlopen('http://www.google.com/seach', params)
print page.read(), page.info() #more data available
Its a little longer i'll give you but it is very cross platform and of course Pythonic.. this wont work with google since they've blocked automated systems ![]() But use PyGoogle, its easy to use! it gives you allot more controle than your gonna get using urllib and regex! http://diveintomark.org/projects/pygoogle/ Mark. |
|
#3
|
||||
|
||||
|
This is a bad idea from a security standpoint too
![]() Code:
search = self.entry.get()
os.system("explorer http://www.google.com/search?sourceid=navclient&q="+search)
At the very minimum, you should urlencode search, otherwise people can input something like: bogus; rm -rf /
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#4
|
||||
|
||||
|
Quote:
hehe i wont even dare to code something like this on linux :P this code is being ran on winblows ![]() btw.. sorry i didnt mean to post the google page see i was creating a dictionary search program just added google for testing to see if it wold work or not.. and for got to replace it with the correct url ![]() Last edited by xlordt : November 21st, 2003 at 03:14 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > os.system() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|