09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1

Introduction

if pageFile.getcode() != 200:

return "Problem in URL"

pageHtml = pageFile.read()

pageFile.close()

return "".join(pageHtml)

def remove_junk(self, arg):

f = open('junk.txt')

for line in f:

arg.replace(line.strip(),'')

return arg

def print_args(self, args):

out =''

last = 0

for arg in args:

if args.index(arg) == len(args) -1:

last = 1

reload(sys)

sys.setdefaultencoding("utf-8")

arg = arg.decode('utf8','ignore').

encode('ascii','ignore').strip()

arg = arg.replace('\n',' ')

arg = arg.replace('\r','')

arg = self.remove_junk(arg)

if last == 0:

out = out + arg + '\t'

else:

out = out + arg

print out

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!