Compatibility with both Python 2(.7) and 3
This commit is contained in:
@@ -24,7 +24,7 @@ def loadfmap( fname ):
|
||||
return fmap, nmap
|
||||
|
||||
def write_nmap( fo, nmap ):
|
||||
for i in xrange( len(nmap) ):
|
||||
for i in range( len(nmap) ):
|
||||
fo.write('%d\t%s\ti\n' % (i, nmap[i]) )
|
||||
|
||||
# start here
|
||||
@@ -41,7 +41,7 @@ for l in open( 'agaricus-lepiota.data' ):
|
||||
else:
|
||||
assert arr[0] == 'e'
|
||||
fo.write('0')
|
||||
for i in xrange( 1,len(arr) ):
|
||||
for i in range( 1,len(arr) ):
|
||||
fo.write( ' %d:1' % fmap[i][arr[i].strip()] )
|
||||
fo.write('\n')
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
import random
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print 'Usage:<filename> <k> [nfold = 5]'
|
||||
print ('Usage:<filename> <k> [nfold = 5]')
|
||||
exit(0)
|
||||
|
||||
random.seed( 10 )
|
||||
|
||||
Reference in New Issue
Block a user