Skip to content

Commit 1427962

Browse files
Fixed small documentation issues and changed #/usr/bin/env ot #!/usr/bin/env
1 parent 89b6f75 commit 1427962

7 files changed

+19
-15
lines changed

client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will open a client connection to localhost on the specified
44
# port. Data is sent to the server and then recv'd from the server. The data

read_file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will open a file and read it line by line, process each line,
44
# and write the processed line to standard out.

read_parse_url.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will read in a URL and parse the contents.
44
# Be aware that URL handling is one of those things that
55
# has changed drastically between Python 2 and 3.
6-
#-----------------------------------------------------------------------------
7-
8-
6+
#
97
# The HTMLParser is Python's built-in library.
108
# It's not that great...and tedious.
119
# BeautifulSoup is a good option if you need an environment
@@ -18,17 +16,20 @@
1816
#
1917
# If you have issues with that or you are on Windows see this for guidance:
2018
# http://lxml.de/index.html#download
19+
#-----------------------------------------------------------------------------
2120

21+
#-----------------------------------------------------------------------------
22+
# Import any needed libraries below
23+
#-----------------------------------------------------------------------------
2224
import lxml.html
2325
import urllib
2426

2527

26-
# The URL we want to parse.
27-
URL_TO_PARSE = "http://www.reddit.com"
28-
2928
#-----------------------------------------------------------------------------
3029
# Begin the main program.
3130
#-----------------------------------------------------------------------------
31+
# The URL we want to parse.
32+
URL_TO_PARSE = "http://www.reddit.com"
3233

3334
# Read in the URL you defined.
3435
# Also note that this handles SSL as well.

read_write_file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will open a file and read it line by line, process each line,
44
# and write the processed line to a file.

regular_expressions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will show the basic uses of regular expressions.
44
#

server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will setup a server on the localhost on the specified port.
44
# Data is received from the client, processed, and echoed back to the client.

write_file.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#/usr/bin/env python
1+
#!/usr/bin/env python
22
#-----------------------------------------------------------------------------
33
# This example will open a file and read it line by line, process each line,
44
# and write the processed line to standard out.
@@ -14,10 +14,13 @@
1414
txt2 = 'Tommy Tutone'
1515
list = ['Everclear', 'Foo Fighters', 'Green Day', 'Goo Goo Dolls']
1616

17-
# The 2.x version of python formats strings using the method below. The 3.x
17+
# The 2.x version of Python formats strings using the method below. The 3.x
1818
# version of python uses .format(). The method below will be phased out of
19-
# python eventually but I use it here because it is compatible with python
19+
# python eventually but I use it here because it is compatible with Python
2020
# 2.x, which is the default version of python in Ubuntu and BT5.
21+
#
22+
# UPDATE: The .format() string formatting method is supported in Python 2.6
23+
# and higher.
2124
outfile.write('%d-%d/%s was sung by %s\n' % (num, num2, txt, txt2))
2225
outfile.write('and was covered by:\n')
2326

0 commit comments

Comments
 (0)