Hey guys....

I want to make a program which reads the HTML code from my blog, saves the HTML code as a string, so that I can check if specific words are present in the HTML code, here's the code I used:

import urllib
import string

open_site=urllib.urlopen('http://www.sravan953.blogspot.com')
read_site=open_site.read()

value=str(read_site)

for item in value:
    print item

But it just doesn't work, because it takes each letter(or you could say character) one by one and runs it in the loop! How do I make it take one whole work at a time?

Thanks in advance
Sravan

Not sure what you mean...

import urllib
import string

open_site=urllib.urlopen('http://www.sravan953.blogspot.com')
read_site=open_site.read()

value=str(read_site)

print value

Oh thanks...
BTW, I wanted to make a program which open a HTML file, and check if a specific word is there, upon which it shuts down the computer, here's the code I used:

import urllib
import os
import time

open_file=open('html.html','r')
file=open_file.read()

def shutdown():
    os.system('shutdown-s')

value=[]
for item in file:
    value.append(item)
    test=''.join(value)
    if test=='shutdown_now':
        shutdown()

But the shutdown script ain't working, can you help me? thanks!

Try:

import urllib
import os
import time

open_file=open('html.html','r')
file=open_file.read()

def shutdown():
    os.system('shutdown -s')

value=[]
for item in file:
    value.append(item)
    test=''.join(value)
    if test=='shutdown_now':
        shutdown()
Comments
Great

Try:

import urllib
import os
import time

open_file=open('html.html','r')
file=open_file.read()

def shutdown():
    os.system('shutdown -s')

value=[]
for item in file:
    value.append(item)
    test=''.join(value)
    if test=='shutdown_now':
        shutdown()

Thanks mate, it worked! I just had give a space b/w 'shutdown' and '-s'...thanks a million!

This question has already been answered. Start a new discussion instead.