All pastes #2048748 Raw Edit

Unnamed

public text v1 · immutable
#2048748 ·published 2011-04-20 19:53 UTC
rendered paste body
from time import sleep
name = raw_input('Enter your name ')
print 'Hello',name
sleep(5)
answer = raw_input('Would you like to run the python web-app? ')
if answer=="yes" or answer=="y" or answer=="sure" or answer=="okay":
	url = raw_input('Please enter a website url: ')
	x = raw_input('Please enter a search word: ')
	import urllib
	html_source = urllib.urlopen(url).read()
	if x in html_source:
		print x,'was found in the webpage'
		words = html_source.split()
		y = words.count(x)
		print 'The word,',x,'was found',y,'times.'
	if x not in html_source:
		print 'Sorry, the string',x,'was not found in the website contents.'
	answer = raw_input('Would you like to see the source code of that webpage? ')
	if answer=="yes" or answer=="y" or answer=="sure" or answer=="okay":
		print html_source
		words = html_source.split()
		y = words.count
	elif answer=="no" or answer=="n":
		exit()
	else:
		print 'Sorry, that command was not recognized.'
	answer = raw_input('Would you like to see how many words there are in the source code? ')
	if answer=="yes" or answer=="y" or answer=="sure" or answer=="okay":
		print len(words)
	elif answer=="n" or answer=="no":
		exit()
	else:
		print 'Sorry, that command was not recognized.'
		raw_input('Would you like to see how many letters there are in the source code of that webpage? ')
		if answer=="yes" or answer=="sure" or answer=="y" or answer=="okay":
			letters = list(str(words))
			q = len(letters)
			print q
		print list(str(words))
		letters = list(str(words))
		q = len(letters)
		a = raw_input('Enter a search letter (or number): ')
		z = letters.count(a)
		print 'That letter (or number) was found',z,'times'
		exit()
	exit()
if answer=="n" or answer=="no":
	exit()
else:
	sleep(20)
	print 'ZZZZZZZZ...'
exit()