Skip to content

Commit 913ff3e

Browse files
committed
Merge pull request REMitchell#9 from TakesxiSximada/fix/remove-semicolon
remove unnecessary semicolons
2 parents b7271da + a6b72fd commit 913ff3e

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

chapter1/2-beautifulSoup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from bs4 import BeautifulSoup
33

44
html = urlopen("http://www.pythonscraping.com/exercises/exercise1.html")
5-
bsObj = BeautifulSoup(html.read());
6-
print(bsObj.h1)
5+
bsObj = BeautifulSoup(html.read())
6+
print(bsObj.h1)

chapter5/6-6DegreesCrawlWiki.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def insertLink(fromPageId, toPageId):
3636
def getLinks(pageUrl, recursionLevel):
3737
global pages
3838
if recursionLevel > 4:
39-
return;
39+
return
4040
pageId = insertPageIfNotExists(pageUrl)
4141
html = urlopen("http://en.wikipedia.org"+pageUrl)
4242
bsObj = BeautifulSoup(html)
@@ -51,4 +51,4 @@ def getLinks(pageUrl, recursionLevel):
5151
print("Skipping: "+str(link.attrs['href'])+" found on "+pageUrl)
5252
getLinks("/wiki/Kevin_Bacon", 0)
5353
cur.close()
54-
conn.close()
54+
conn.close()

chapter6/5-readPdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def readPDF(pdfFile):
1818
retstr.close()
1919
return content
2020

21-
pdfFile = urlopen("http://pythonscraping.com/pages/warandpeace/chapter1.pdf");
21+
pdfFile = urlopen("http://pythonscraping.com/pages/warandpeace/chapter1.pdf")
2222
outputString = readPDF(pdfFile)
2323
print(outputString)
24-
pdfFile.close()
24+
pdfFile.close()

chapter6/readPdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def readPDF(pdfFile):
1818
retstr.close()
1919
return content
2020

21-
pdfFile = urlopen("http://pythonscraping.com/pages/warandpeace/chapter1.pdf");
21+
pdfFile = urlopen("http://pythonscraping.com/pages/warandpeace/chapter1.pdf")
2222
outputString = readPDF(pdfFile)
2323
print(outputString)
24-
pdfFile.close()
24+
pdfFile.close()

chapter8/3-markovGenerator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def retrieveRandomWord(wordList):
1717

1818
def buildWordDict(text):
1919
#Remove newlines and quotes
20-
text = text.replace("\n", " ");
21-
text = text.replace("\"", "");
20+
text = text.replace("\n", " ")
21+
text = text.replace("\"", "")
2222

2323
#Make sure puncuation are treated as their own "word," so they will be included
2424
#in the Markov chain
2525
punctuation = [',','.',';',':']
2626
for symbol in punctuation:
27-
text = text.replace(symbol, " "+symbol+" ");
27+
text = text.replace(symbol, " "+symbol+" ")
2828

2929
words = text.split(" ")
3030
#Filter out empty words

chapter8/4-6DegreesFinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def searchBreadth(targetPageId, currentPageId, depth, nodes):
4242
print(found)
4343
for node in found:
4444
print(getUrl(node))
45-
break;
45+
break
4646
else:
4747
print("No path found")
4848

0 commit comments

Comments
 (0)