mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			646 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			646 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#! /usr/bin/python3
 | 
						|
import sys,os
 | 
						|
 | 
						|
if len(sys.argv) != 3:
 | 
						|
    sys.exit('Error fix_mem.py expects 2 args:\n fix_mem.py <input filename> <output filename>')
 | 
						|
inputFile = sys.argv[1]
 | 
						|
outputFile = sys.argv[2]
 | 
						|
if not os.path.exists(inputFile):
 | 
						|
    sys.exit('Error input file '+inputFile+' not found')
 | 
						|
print('Begin translating '+os.path.basename(inputFile)+' to '+os.path.basename(outputFile))
 | 
						|
with open(inputFile, 'r') as f:
 | 
						|
    with open(outputFile, 'w') as w:
 | 
						|
        for l in f:
 | 
						|
            w.write(f'{"".join([x[2:] for x in l.split()[:0:-1]])}\n')
 | 
						|
print('Finished translating '+os.path.basename(inputFile)+' to '+os.path.basename(outputFile)+'!')
 |