Regex trouble
I am trying to loop over a dictionary of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working though. My regex's are these international__iregex=r'^1?(011|001)' local__iregex=r'^1?(281|832|713|800)' #long distance ld_regex=r'^1?(281|832|713|800|866|877|011|001|888)' long_distance= {} My loop: for key1,value1 in x.items(): if key1 == 'dest': if re.search(ld_regex,value1): long_distance[key1] = value1 print long_distance -- http://mail.python.org/mailman/listinfo/python-list
Regex trouble
I am trying to loop over a dictionary of phone numbers and using a python regex to determine if they are long distance or local and then adding them to their appropriate dictionary, My regex doesn't appear to be working though. My regex's are these international__iregex=r'^1?(011|001)' #Anything starting with these prefixes is International local__iregex=r'^1?(281|832|713|800)' #anything starting with these are local #long distance ld_regex=r'^1?(281|832|713|800|866|877|011|001|888)' #any number not starting with these prefixes is long distance long_distance= {} My loop: for key1,value1 in x.items(): if key1 == 'dest': if not re.search(ld_regex,value1): long_distance[key1] = value1 print long_distance -- http://mail.python.org/mailman/listinfo/python-list
Searching Dictionary
i am trying to search a large Python dictionary for a matching value. The results would need to be structured into a new dictionary with the same structure. Thanks. The structure is like this { Key : [{'item':value,'item2':value,' item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}], Key2 : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}], Key3 : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] } -- http://mail.python.org/mailman/listinfo/python-list
Re: Searching Dictionary
Sorry for the confusion, Simon, this is almost exactly what I need, but i need to be able to search for a string in a given value of an item Here is an example of the dict I am working with {'252': [{'code': '51679', 'date': '2009-08-01 11:35:38', 'userfield': '252', 'from': '9876662881', 'to': '19877760406', 'fpld': 'Foobar 9855562881', 'result': 'ANSW', 'sec': 131}, {'code': '51679', 'date': '2009-08-01 14:33:55', 'userfield': '252', 'from': '9876662881', 'to': '1980391', 'fpld': 'Foobar 9876555881', 'result': 'ANSW', 'sec': 86}]} 252 being the key, I need to be able to search for a string in a given item , say 777 in the 'to' field so print wtf(dict,'to','777') would return {'252': [{'code': '51679', 'date': '2009-08-01 11:35:38', 'userfield': '252', 'from': '9876662881', 'to': '19877760406', 'fpld': 'Brochsteins 9855562881', 'result': 'ANSWERED', 'billsec': 131}, {'code': '51679', 'date': '2009-08-01 14:33:55', 'userfield': '252', 'from': '9876662881', 'to': '1980391', 'fpld': 'Brochsteins 9876555881', 'result': 'ANSWERED', 'billsec': 86}]} I hope this makes sense, sorry for not being clear On Wed, Sep 23, 2009 at 3:34 PM, Simon Forman sajmik...@gmail.com wrote: On Wed, Sep 23, 2009 at 2:31 PM, Support Desk support.desk@gmail.com wrote: i am trying to search a large Python dictionary for a matching value. The results would need to be structured into a new dictionary with the same structure. Thanks. The structure is like this { Key : [{'item':value,'item2':value,' item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}], Key2 : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}], Key3 : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] } There is not really enough information to answer your query directly. But I'll take a guess anyway. First, let's put your in a piece of code that will actually run (which is what you shourd have done in the first place..): Key = Key2 = Key3 = value = 42 D = { Key: [ {'item':value, 'item2':value, 'item3':123, 'item4':value, 'item5':value, 'item6':value, 'item7':value, 'item8':value, 'item9':value} ], Key2: [ {'item':value, 'item2':value, 'item3':value, 'item4':value, 'item5':value, 'item6':value, 'item7':value, 'item8':value, 'item9':value} ], Key3: [ {'item':value, 'item2':value, 'item3':123, 'item4':value, 'item5':value, 'item6':value, 'item7':value, 'item8':value, 'item9':value} ] } Now let's write a function that (maybe) does what you (kind of) specified: def wtf(d, match_me): result = {} for key, value in d.iteritems(): inner_dict = value[0] for inner_key, inner_value in inner_dict.iteritems(): if inner_value == match_me: result[key] = [{inner_key: inner_value}] return result And let's try it: print wtf(D, 42) That prints: {42: [{'item': 42}]} Is that what you're asking for? -- http://mail.python.org/mailman/listinfo/python-list
Searching a large dictionary
I need help searching a large python dictionary. The dictionary is setup like so Key[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] Key2[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] Key3[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] What would be the best way to search for a specific value of item1 and add all the results to a new dictionary? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Searching a large dictionary
Chris, Yes that is the correct syntax, thanks On Tue, Sep 22, 2009 at 5:22 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Sep 22, 2009 at 2:50 PM, Support Desk support.desk@gmail.com wrote: I need help searching a large python dictionary. The dictionary is setup like so Key[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] Key2[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] Key3[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] That is not valid syntax. Do you mean you have a dictionary like this?: { Key : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}], Key2 : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}], Key3 : [{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}] } Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
RE: Open source web crawler with mysql integration
Sounds Interesting. When its done would you care to share it? Sincerely, Michael H. -Original Message- From: Philip Semanchuk [mailto:phi...@semanchuk.com] Sent: Thursday, April 09, 2009 9:46 PM To: Python Subject: Re: Open source web crawler with mysql integration On Apr 9, 2009, at 7:37 PM, Daniel Fetchinson wrote: I'm looking for a crawler that can spider my site and toss the results into mysql so, in turn, that database can be indexed by Sphinx Search. Since I don't want to reinvent the wheel, is anyone aware of any open source projects or code snippets that can already handle this? Have a look at http://nikitathespider.com/python/ As the author of Nikita, I can say that (a) she used Postgres and (b) the code wasn't open sourced except for a couple of small parts. The service is now defunct. It wasn't making money. Ideally I'd like to open source the code one day, but it would take a lot of documentation work to make it installable by others, and I won't have the time to do that for the foreseeable future. At the URL provided there's a nice module for parsing robots.txt files (better than the one in the standard library IMHO) but that's about it. FYI, I wrote my spider in Python because I couldn't find a decent one written in Python. There's Nutch, but that's not Python (Java I think). Good luck Philip -- http://mail.python.org/mailman/listinfo/python-list
RE: Scraping a web page
You could do something like below to get the rendered page. Import os site = 'website.com' X = os.popen('lynx --dump %s' % site).readlines() -Original Message- From: Tim Chase [mailto:python.l...@tim.thechases.com] Sent: Tuesday, April 07, 2009 7:45 AM To: Ronn Ross Cc: python-list@python.org Subject: Re: Scraping a web page f = urllib.urlopen(http://www.google.com;) s = f.read() It is working, but it's returning the source of the page. Is there anyway I can get almost a screen capture of the page? This is the job of a browser -- to render the source HTML. As such, you'd want to look into any of the browser-automation libraries to hook into IE, FireFox, Opera, or maybe using the WebKit/KHTML control. You may then be able to direct it to render the HTML into a canvas you can then treat as an image. Another alternative might be provided by some web-services that will render a page as HTML with various browsers and then send you the result. However, these are usually either (1) asynchronous or (2) paid services (or both). -tkc -- http://mail.python.org/mailman/listinfo/python-list
RE: Scraping a web page
If your only interested in the Images, perhaps you want to use wget like: wget -r --accept=jpg,jpeg www.xyz.org or maybe this http://www.vex.net/~x/python_stuff.html BackCrawler http://www.vex.net/%7Ex/files/backcrawler.zip 1.1 A crude web spider with only one purpose: mercilessly suck the background images from all web pages it can find. Understands frames and redirects, uses MD5 to elimate duplicates. Need web page backgrounds? This'll get lots of them. Sadly, most are very tacky, and Backcrawler can't help with that. Requires Threads. _ From: Ronn Ross [mailto:ronn.r...@gmail.com] Sent: Tuesday, April 07, 2009 9:37 AM To: Support Desk Subject: Re: Scraping a web page This works great, but is there a way to do this with firefox or something similar so I can also print the images from the site? On Tue, Apr 7, 2009 at 9:58 AM, Support Desk support.desk@gmail.com wrote: You could do something like below to get the rendered page. Import os site = 'website.com' X = os.popen('lynx --dump %s' % site).readlines() -Original Message- From: Tim Chase [mailto:python.l...@tim.thechases.com] Sent: Tuesday, April 07, 2009 7:45 AM To: Ronn Ross Cc: python-list@python.org Subject: Re: Scraping a web page f = urllib.urlopen(http://www.google.com;) s = f.read() It is working, but it's returning the source of the page. Is there anyway I can get almost a screen capture of the page? This is the job of a browser -- to render the source HTML. As such, you'd want to look into any of the browser-automation libraries to hook into IE, FireFox, Opera, or maybe using the WebKit/KHTML control. You may then be able to direct it to render the HTML into a canvas you can then treat as an image. Another alternative might be provided by some web-services that will render a page as HTML with various browsers and then send you the result. However, these are usually either (1) asynchronous or (2) paid services (or both). -tkc -- http://mail.python.org/mailman/listinfo/python-list
Capture Keystrokes from a USB Wireless Keyboard.
Does anybody know of a way to capture keystrokes form a wireless USB keyboard using python? -- http://mail.python.org/mailman/listinfo/python-list
RE: Capture Keystrokes from a USB Wireless Keyboard.
Thanks, I'm looking for something I can integrate into a simple game I'm working on that will run in Linux. -Original Message- From: Shane Geiger [mailto:sgei...@councilforeconed.org] Sent: Friday, February 27, 2009 9:09 AM To: Support Desk Cc: python-list@python.org Subject: Re: Capture Keystrokes from a USB Wireless Keyboard. Here's one option: http://pykeylogger.sourceforge.net/wiki/index.php/PyKeylogger:FAQ Support Desk wrote: Does anybody know of a way to capture keystrokes form a wireless USB keyboard using python? -- http://mail.python.org/mailman/listinfo/python-list -- Shane Geiger, IT Director Council For Economic Education / www.councilforeconed.org sgei...@councilforeconed.org / 402-438-8958 Teaching Opportunity -- http://mail.python.org/mailman/listinfo/python-list
RE: Web crawler on python
-Original Message- From: James Mills [mailto:[EMAIL PROTECTED] Sent: Sunday, October 26, 2008 5:26 PM To: sonich Cc: python-list@python.org Subject: Re: Web crawler on python On Mon, Oct 27, 2008 at 6:54 AM, sonich [EMAIL PROTECTED] wrote: I need simple web crawler, I found Ruya, but it's seems not currently maintained. Does anybody know good web crawler on python or with python interface? Simple, but it works. Extend it all you like. http://hg.softcircuit.com.au/index.wsgi/projects/pymills/file/330d047ff663/e xamples/spider.py $ spider.py --help Usage: spider.py [options] url Options: --version show program's version number and exit -h, --helpshow this help message and exit -q, --quiet Enable quiet mode -l, --links Get links for specified url only -d DEPTH, --depth=DEPTH Maximum depth to traverse cheers James -- -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list
account balance checker
Hello all, I was wondering if it would be possible to make a script to grab my balance account balance a few times a day without having to login every time. I know I can use the urlib2 library, but not sure how to go about filling in the forms and submitting them. BOA has a mobile site that is pretty simple. Anyone else use Bank of America and would be interested in this. This is not for anything illegal, just for me to prevent overdrafting my account https://sitekey.bankofamerica.com/sas/signonScreen.do?isMobileDevice=true y = urllib.urlopen('https://sitekey.bankofamerica.com/sas/signonScreen.do?isMobl eDevice=true',urllib.urlencode({'onlineID':'MYONLLINEID'})).readlines() -- http://mail.python.org/mailman/listinfo/python-list
RE: account balance checker
I was also looking at the ClientForm Library http://wwwsearch.sourceforge.net/ClientForm/ which can get me past the first username form, but I noticed it then goes to a challenge question form and im not sure how to take the resulting for and resubmit it with new information and then resubmit the resulting form with the password -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Rebert Sent: Thursday, October 16, 2008 10:15 AM To: Support Desk Cc: python-list@python.org Subject: Re: account balance checker You'd probably have to use something like mechanize (http://wwwsearch.sourceforge.net/mechanize/) to fill out the forms, but if BofA's website uses Javascript at all, you're probably out of luck. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com On Wed, Oct 15, 2008 at 8:09 AM, Support Desk [EMAIL PROTECTED] wrote: Hello all, I was wondering if it would be possible to make a script to grab my balance account balance a few times a day without having to login every time. I know I can use the urlib2 library, but not sure how to go about filling in the forms and submitting them. BOA has a mobile site that is pretty simple. Anyone else use Bank of America and would be interested in this. This is not for anything illegal, just for me to prevent overdrafting my account https://sitekey.bankofamerica.com/sas/signonScreen.do?isMobileDevice=true y = urllib.urlopen('https://sitekey.bankofamerica.com/sas/signonScreen.do?isMobl eDevice=true',urllib.urlencode({'onlineID':'MYONLLINEID'})).readlines() -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: Porn Addiction Solutions?
I got a solution, cutt it off, and then Kill yourself. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 08, 2008 2:30 PM To: python-list@python.org Subject: Re: Porn Addiction Solutions? On Oct 8, 3:07 pm, [EMAIL PROTECTED] wrote: Help, I'm addicted to porn. I've been spending a lot of time downloading hardcore porn and masturbating to it. It's ruining my life. I just found out that one of these sites somehow hacked my card and rang up $5K in charges which they won't even refund me. Even with that I haven't stopped my habit and it's only getting worse. How can I end this addiction? Any suggestions? You need to install a porn filter on your computer. Don't ever surf unprotected. A good filter program is Optenet PC which you can get at optenetpc.com. Be sure to change the password to something you won't remember so that you won't be tempted to circumvent the filter. You have made the first step by recognizing excessive pornography use is a problem in your life. Now you need to change your habits. Use the filter as a first line of defense to block access to this material from your computer. Then look at how you can alter the factors that lead to this behavior. See these tips: Change routines and environments that lead to pornography usage. Avoid high risk situations. Learn new ways of coping with strong feelings like anxiety, loneliness, anger, depression, and boredom. Identify activities that can help you relax, enjoy yourself, and feel refreshed. From: http://www.utdallas.edu/counseling/selfhelp/porn-addiction.html You can conquer this thing. Let us know how you make out. Regards, Mike -- http://mail.python.org/mailman/listinfo/python-list
RE: Porn Addiction Solutions?
Oh in that case she can email me, I got lots of porn. -Original Message- From: Dotan Cohen [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 08, 2008 3:15 PM To: Support Desk Cc: [EMAIL PROTECTED]; python-list@python.org Subject: Re: Porn Addiction Solutions? 2008/10/8 Support Desk [EMAIL PROTECTED]: I got a solution, cutt it off, and then Kill yourself. Cut what off? The OP is female. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ä-ö-ü-ß-Ä-Ö-Ü -- http://mail.python.org/mailman/listinfo/python-list
RE: Regex Help
Thanks for the reply, I found out the problem was occurring later on in the script. The regexp works well. -Original Message- From: Lawrence D'Oliveiro [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2008 6:51 PM To: python-list@python.org Subject: Re: Regex Help In message [EMAIL PROTECTED], Support Desk wrote: Anybody know of a good regex to parse html links from html code? The one I am currently using seems to be cutting off the last letter of some links, and returning links like http://somesite.co or http://somesite.ph the code I am using is regex = r'a href=[|\']([^|\']+)[|\']' Can you post some example HTML sequences that this regexp is not handling correctly? -- http://mail.python.org/mailman/listinfo/python-list
More regex help
I am working on a python webcrawler, that will extract all links from an html page, and add them to a queue, The problem I am having is building absolute links from relative links, as there are so many different types of relative links. If I just append the relative links to the current url, some websites will send it into a never-ending loop. What I am looking for is a regexp that will extract the root url from any url string I pass to it, such as 'http://example.com/stuff/stuff/morestuff/index.html' Regexp = http:example.com 'http://anotherexample.com/stuff/index.php Regexp = 'http://anotherexample.com/ 'http://example.com/stuff/stuff/ Regext = 'http://example.com' -- http://mail.python.org/mailman/listinfo/python-list
RE: More regex help
Kirk, That's exactly what I needed. Thx! -Original Message- From: Kirk Strauser [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2008 11:42 AM To: python-list@python.org Subject: Re: More regex help At 2008-09-24T16:25:02Z, Support Desk [EMAIL PROTECTED] writes: I am working on a python webcrawler, that will extract all links from an html page, and add them to a queue, The problem I am having is building absolute links from relative links, as there are so many different types of relative links. If I just append the relative links to the current url, some websites will send it into a never-ending loop. import urllib urllib.basejoin('http://www.example.com/path/to/deep/page', '/foo') 'http://www.example.com/foo' urllib.basejoin('http://www.example.com/path/to/deep/page', 'http://slashdot.org/foo') 'http://slashdot.org/foo' -- Kirk Strauser The Day Companies -- http://mail.python.org/mailman/listinfo/python-list
Regex Help
Anybody know of a good regex to parse html links from html code? The one I am currently using seems to be cutting off the last letter of some links, and returning links like http://somesite.co or http://somesite.ph the code I am using is regex = r'a href=[|\']([^|\']+)[|\']' page_text = urllib.urlopen('http://somesite.com') page_text = page_text.read() links = re.findall(regex, text, re.IGNORECASE) -- http://mail.python.org/mailman/listinfo/python-list
RE: How do I add permanently to Pythons sys.path?
What about on a unix box? Sincerely, Michael H. -Original Message- From: Aaron Castironpi Brady [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 12:49 PM To: python-list@python.org Subject: Re: How do I add permanently to Pythons sys.path? On Sep 16, 10:13 am, cnb [EMAIL PROTECTED] wrote: sys.path ['C:\\Python25\\Progs\\NatLangProc', 'C:\\Python25\\Lib\\idlelib', 'C:\ \Windows\\system32\\python25.zip', 'C:\\Python25\\lib\\site-packages\ \orange', 'C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets', 'C:\\Python25\\lib\\site-packages\\orange\\OrangeCanvas', 'C:\ \Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site- packages', 'C:\\Python25\\lib\\site-packages\\Numeric', 'C:\\Python25\ \lib\\site-packages\\PIL'] Now I have my personal programs in C:/Python25/Progs/ How do I add so that I can just do import somefile from anywhere in that directory in the interpreter and it can load files from other folders in that directory. Add a file: \Lib\site-packages\locals.pth with contents, path to the directory you want to add (/python25/progs/) -- http://mail.python.org/mailman/listinfo/python-list
RE: Adding Icons to my Programs
-Original Message- From: Kevin McKinley [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 4:37 PM To: python-list@python.org Subject: Adding Icons to my Programs I've been turn my script into executible programs with Py2exe. Is there a way to change the icon for the main exe file? Thank you, Kevin McKinley -- http://mail.python.org/mailman/listinfo/python-list
RE: Adding Icons to my Programs
Sincerely, Michael H. -Original Message- From: Kevin McKinley [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 4:37 PM To: python-list@python.org Subject: Adding Icons to my Programs I've been turn my script into executible programs with Py2exe. Is there a way to change the icon for the main exe file? Thank you, Kevin McKinley -- http://mail.python.org/mailman/listinfo/python-list
RE: Adding Icons to my Programs
Take a look at this: http://www.velocityreviews.com/forums/t332696-setting-icon-using-py2exe.html -Original Message- From: Kevin McKinley [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 4:37 PM To: python-list@python.org Subject: Adding Icons to my Programs I've been turn my script into executible programs with Py2exe. Is there a way to change the icon for the main exe file? Thank you, Kevin McKinley -- http://mail.python.org/mailman/listinfo/python-list
RE: Hide raw_input text?
-Original Message- From: tmallen [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 12:26 PM To: python-list@python.org Subject: Hide raw_input text? I'm working on a little FTP project to get comfortable with ftplib. It's all terminal-based right now, and one issue I'm having is hiding password input text. I'd like one of two things to happen with this: Either don't show any characters while I'm typing (like $ su), or better, a '*' for every character. Is there a way to do this? I'm planning on building this into a GUI tool using Tkinter or wxPython, so methods using a secret input for those might be helpful as well ( I could jump straight into the GUI part). Thanks! -- http://mail.python.org/mailman/listinfo/python-list
RE: internet searching program
Yes, I believe the custom search allows you to embed a google search into your website and customize it, but they no longer allow you to use a script to access search results unless you go about it in a roundabout way http://googlesystem.blogspot.com/2006/12/googles-soap-search-api-no-longer.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 3:09 AM To: python-list@python.org Subject: Re: internet searching program On 8月12日, 下午1时44分, alex23 [EMAIL PROTECTED] wrote: On Aug 12, 12:03 am, Support Desk [EMAIL PROTECTED] wrote: Google does'nt allow use of their API's anymore, I belive Yahoo has one Are you sure? Google Custom Search enables you to search over a website or a collection of websites. You can harness the power of Google to create a search engine tailored to your needs and interests, and you can present the results in your website. Your custom search engine can prioritize or restrict search results based on websites you specify. http://code.google.com/apis/customsearch/ http://www.muffler-silencer.com [url=http://www.muffler-silencer.com]V-4 type Series Muffler[/url] [url=http://www.muffler-silencer.com]B type Series Muffler[/url] -- http://mail.python.org/mailman/listinfo/python-list
RE: internet searching program
Google does'nt allow use of their API's anymore, I belive Yahoo has one or you could do something like below. searchstring = 'stuff here' x = os.popen('lynx -dump http://www.google.com/search?q=%s' % searchstring).readlines() -Original Message- From: Steven D'Aprano [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2008 11:22 PM To: python-list@python.org Subject: Re: internet searching program On Fri, 08 Aug 2008 19:59:02 -0700, KillSwitch wrote: Is it possible to make a program to search a site on the internet, then get certain information from the web pages that match and display them? Like, you would put in keywords to be searched for on youtube.com, then it would search youtube.com, get the names of the videos, the links, and the embed information? Or something like that. Search the Internet? Hmmm... I'm not sure, but I think Google does something quite like that, but I don't know if they do it with a computer program or an army of trained monkeys. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
RE: SSH utility
What about pexpect? http://www.noah.org/wiki/Pexpect -Original Message- From: Alan Franzoni [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2008 5:41 AM To: python-list@python.org Subject: Re: SSH utility James Brady was kind enough to say: Hi all, I'm looking for a python library that lets me execute shell commands on remote machines. I've tried a few SSH utilities so far: paramiko, PySSH and pssh; unfortunately all been unreliable, and repeated questions on their respective mailing lists haven't been answered... Twisted conch seems to be your last chance :-) -- Alan Franzoni [EMAIL PROTECTED] - Remove .xyz from my email in order to contact me. - GPG Key Fingerprint: 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E -- http://mail.python.org/mailman/listinfo/python-list
RE: I need a Python mentor
U...yea _ From: A. Joseph [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2008 1:44 PM To: python-list@python.org Subject: I need a Python mentor How are you? You look good; I will like to meet you. Visit my profile and drop some line for me. Abah Hello everybody, i`m new to this list. I was programming in PHP before, so just of recent I started learning python. I need someone who I can be giving me some assignment based on the chapter I read in the book, and tell person will sometime review my code and tell me if it well structured. Can you be my mentor? -- http://mail.python.org/mailman/listinfo/python-list
python lists and newline character
Hello all, I am using os.popen to get a list returned of vpopmail users, something like this x = os.popen('/home/vpopmail/bin/vuserinfo -n -D mydomain.com).readlines() x returns a list, of usernames, and I am trying to append the usernames with the domain like so for line in x: print line + '@' + domain but instead of getting [EMAIL PROTECTED] im getting a newline character like: user @domain.com User @comain.com User2 @domain.com Is there some way I can get this list without the newline characters being added. or somehow remove the newline characters. Any help would be appreciated. -- http://mail.python.org/mailman/listinfo/python-list
variable question
I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if statement. Is there any better way to assign variables using an if statement or exception so I don't have to write two almost identical if statements. This is probably a dumb question. -- http://mail.python.org/mailman/listinfo/python-list
regex help
Hello, I am working on a web-app, that querys long distance numbers from a database of call logs. I am trying to put together a regex that matches any number that does not start with the following. Basically any number that does'nt start with: 281 713 832 or 1281 1713 1832 is long distance any, help would be appreciated. -- http://mail.python.org/mailman/listinfo/python-list
regex help
I am trying to put together a regular expression that will rename users address books on our server due to a recent change we made. Users with address books user.abook need to be changed to [EMAIL PROTECTED] I'm having trouble with the regex. Any help would be appreciated. -Mike -- http://mail.python.org/mailman/listinfo/python-list
RE: regex help
Thats it exactly..thx -Original Message- From: Reedick, Andrew [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2008 9:26 AM To: Support Desk Subject: RE: regex help The regex will now skip anything with an '@'in the filename on the assumption it's already in the correct format. Uncomment the os.rename line once you're satisfied you won't mangle anything. import glob import os import re for filename in glob.glob('*.abook'): newname = filename newname = re.sub(r'[EMAIL PROTECTED]', '@domain.com.abook', filename) if filename != newname: print rename, filename, to, newname #os.rename(filename, newname) -Original Message- From: Support Desk [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2008 10:07 AM To: Reedick, Andrew Subject: RE: regex help Thx for the reply, I would first have to list all files matching user.abook then rename them to [EMAIL PROTECTED] something like Im still new to python and haven't had much experience with the re module import os import re emails = os.popen('ls').readlines() for email in emails: print email, '--', print re.findall(r'\.abook$', email) -Original Message- From: Reedick, Andrew [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2008 8:52 AM To: Support Desk; python-list@python.org Subject: RE: regex help From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Support Desk Sent: Tuesday, June 03, 2008 9:32 AM To: python-list@python.org Subject: regex help I am trying to put together a regular expression that will rename users address books on our server due to a recent change we made. Users with address books user.abook need to be changed to [EMAIL PROTECTED] I'm having trouble with the regex. Any help would be appreciated. import re emails = ('foo.abook', 'abook.foo', 'bob.abook.com', 'john.doe.abook') for email in emails: print email, '--', print re.sub(r'\.abook$', '@domain.com.abook', email) * The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA623 -- http://mail.python.org/mailman/listinfo/python-list