X Tutup
Skip to content

Commit 92c14d0

Browse files
committed
Initial run of 2to3
1 parent 9e01dda commit 92c14d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1603
-1844
lines changed

code3/BeautifulSoup.py

Lines changed: 87 additions & 86 deletions
Large diffs are not rendered by default.

code3/argfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
name = sys.argv[1]
44
handle = open(name, 'r')
55
text = handle.read()
6-
print name, 'is', len(text), 'bytes'
6+
print(name, 'is', len(text), 'bytes')

code3/argtest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import sys
22

3-
print 'Count:', len(sys.argv)
4-
print 'Type:', type(sys.argv)
3+
print('Count:', len(sys.argv))
4+
print('Type:', type(sys.argv))
55

66
for arg in sys.argv:
7-
print 'Argument:', arg
7+
print('Argument:', arg)
88

code3/avelist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
numlist = list()
22
while ( True ) :
3-
inp = raw_input('Enter a number: ')
3+
inp = input('Enter a number: ')
44
if inp == 'done' : break
55
value = float(inp)
66
numlist.append(value)
77

88
average = sum(numlist) / len(numlist)
9-
print 'Average:', average
9+
print('Average:', average)

code3/avenum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
total = 0
22
count = 0
33
while ( True ) :
4-
inp = raw_input('Enter a number: ')
4+
inp = input('Enter a number: ')
55
if inp == 'done' : break
66
value = float(inp)
77
total = total + value
88
count = count + 1
99

1010
average = total / count
11-
print 'Average:', average
11+
print('Average:', average)

code3/average.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
total = 0
22
count = 0
33
while ( True ) :
4-
inp = raw_input('Enter a number: ')
4+
inp = input('Enter a number: ')
55
if inp == 'done' :
66
break
77
try:
88
value = float(inp)
99
except:
10-
print 'Invalid input'
10+
print('Invalid input')
1111
continue
1212
total = total + value
1313
count = count + 1
1414

1515
average = total / count
16-
print 'Average:', average
16+
print('Average:', average)

code3/celsius.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
inp = raw_input('Enter Celsius Temperature:')
1+
inp = input('Enter Celsius Temperature:')
22
cel = float(inp)
33
fahr = ( cel * 9.0 ) / 5.0 + 32.0
4-
print fahr
4+
print(fahr)

code3/copytildone.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
while True:
2-
line = raw_input('> ')
2+
line = input('> ')
33
if line[0] == '#' :
44
continue
55
if line == 'done':
66
break
7-
print line
7+
print(line)
88

9-
print 'Done!'
9+
print('Done!')
1010

code3/count1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
fname = raw_input('Enter the file name: ')
1+
fname = input('Enter the file name: ')
22
try:
33
fhand = open(fname)
44
except:
5-
print 'File cannot be opened:', fname
5+
print('File cannot be opened:', fname)
66
exit()
77

88
counts = dict()
@@ -14,4 +14,4 @@
1414
else:
1515
counts[word] += 1
1616

17-
print counts
17+
print(counts)

code3/count2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import string
22

3-
fname = raw_input('Enter the file name: ')
3+
fname = input('Enter the file name: ')
44
try:
55
fhand = open(fname)
66
except:
7-
print 'File cannot be opened:', fname
7+
print('File cannot be opened:', fname)
88
exit()
99

1010
counts = dict()
@@ -18,4 +18,4 @@
1818
else:
1919
counts[word] += 1
2020

21-
print counts
21+
print(counts)

0 commit comments

Comments
 (0)
X Tutup