Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3793135
D1352.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D1352.diff
View Options
Index: eliminate-common-nouns
===================================================================
--- eliminate-common-nouns
+++ eliminate-common-nouns
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import os.path
@@ -8,13 +8,13 @@
#
if len(sys.argv) != 2:
- print 'Usage:', sys.argv[0], '<text file>'
+ print('Usage:', sys.argv[0], '<text file>')
sys.exit(1)
filename = sys.argv[1]
if not os.path.exists(filename):
- print filename + ': no such file'
+ print(filename + ': no such file')
sys.exit(2)
#
@@ -28,4 +28,4 @@
for line in file:
candidate = line.strip()
if candidate.lower() not in englishWords:
- print candidate
+ print(candidate)
Index: extract-proper-nouns
===================================================================
--- extract-proper-nouns
+++ extract-proper-nouns
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import os.path
@@ -13,13 +13,13 @@
#
if len(sys.argv) != 2:
- print 'Usage:', sys.argv[0], '<text file>'
+ print('Usage:', sys.argv[0], '<text file>')
sys.exit(1)
filename = sys.argv[1]
if not os.path.exists(filename):
- print filename + ': no such file'
+ print(filename + ': no such file')
sys.exit(2)
#
@@ -53,8 +53,8 @@
continue
if len(currentCandidate) > 0:
- print ' '.join(currentCandidate)
+ print(' '.join(currentCandidate))
currentCandidate = []
if len(currentCandidate) > 0:
- print ' '.join(currentCandidate)
+ print(' '.join(currentCandidate))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 19:40 (22 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2269752
Default Alt Text
D1352.diff (1 KB)
Attached To
Mode
D1352: Shift to Python 3
Attached
Detach File
Event Timeline
Log In to Comment