import sys,os,msvcrt,re
main_path = os.getcwd().replace('\\','/')
output_text = ''
try:
os.remove(main_path+'/output.txt')
except:
pass
print 'custom program for bittu123\n'
try:
file_input = open(main_path+'/input.txt', 'r')
lines = file_input.readlines()
line_number = 0
output_list = []
parsed_data = []
for line in lines:
line_number+=1
parsed_data.append(re.split('\s', line.lstrip()))
for i in range(line_number):
output_list.append(i)
output_list[i]=parsed_data[i]
pos = 0
for letter in parsed_data[i]:
pos+=1
if letter.isalpha():
letter_position = pos-1
data_len = len(parsed_data)
if i<(data_len-1):
element = i+1
else:
element = i
if i!=(data_len-1):
for a in parsed_data[element]:
if a.isdigit():
output_list[i][letter_position:letter_position]=[int(a)-1]
letter_position+=1
else:
output_list[i][letter_position:letter_position]=['blank']
except:
print 'Opening the file has failed / No file found.'
for w in output_list:
for wr in w:
output_text+=str(wr)+' '
output_text+='\n'
try:
output_file = open('D:/Python27/project/output.txt','a')
output_file.write(output_text)
output_file.close()
except:
print 'Writing the file has failed.'
file_open = raw_input('Open the output file? y/n\n')
if file_open == 'y':
try:
os.startfile(main_path+'/output.txt')
except:
print 'File lounching has failed.'
pass
print '\nPress any key to exit'
ch = msvcrt.getch()
brutalenemy666: do not give code as a free handout. In the long run, spoonfeeding is harmful. When you do show code, post it in [code][/code] bbcode tags. This is especially essential for Python where a difference in indentation can alter the meaning of the code.
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.