sonictooth
05-10-2002, 08:39 AM
#! /usr/bin/python2.0
def start():
print "File Editor"
print "1: new file"
print "2: open file"
print "3: quit"
ochoice = input("?:")
if ochoice == 1:
new()
elif ochoice == 2:
openf()
else:
print "quit"
def openf():
import os
dir = raw_input("Directory?:")
os.chdir(dir)
dirprint = os.listdir(dir)
print dirprint
fpath = raw_input("File name?:")
f=open(fpath,'r+')
quitfedit = 0
while quitfedit == 0:
f.seek(0)
fcon = f.read()
print ".0 .10 .20 .30 .40 .50"
print fcon
inputspace = input("Byte to input at?:")
f.seek(inputspace)
print " .0 .10 .20 .30 .40 .50"
texttowrite = raw_input("Text to write?:")
f.write(texttowrite)
back = input("1: continue editing, 2: return to main menu:")
if back == 2:
quitfedit = 1
else:
quitfedit = 0
start()
def new():
import os
dir = raw_input("Directory?:")
os.chdir(dir)
dirprint = os.listdir(dir)
print dirprint
fnew = raw_input("File name?:")
f=open(fnew,'w')
f.write(' ')
f.close()
openf()
start()
so far only edits one line oh well
i wrote a python script in it and then i felt alll powerfull
def start():
print "File Editor"
print "1: new file"
print "2: open file"
print "3: quit"
ochoice = input("?:")
if ochoice == 1:
new()
elif ochoice == 2:
openf()
else:
print "quit"
def openf():
import os
dir = raw_input("Directory?:")
os.chdir(dir)
dirprint = os.listdir(dir)
print dirprint
fpath = raw_input("File name?:")
f=open(fpath,'r+')
quitfedit = 0
while quitfedit == 0:
f.seek(0)
fcon = f.read()
print ".0 .10 .20 .30 .40 .50"
print fcon
inputspace = input("Byte to input at?:")
f.seek(inputspace)
print " .0 .10 .20 .30 .40 .50"
texttowrite = raw_input("Text to write?:")
f.write(texttowrite)
back = input("1: continue editing, 2: return to main menu:")
if back == 2:
quitfedit = 1
else:
quitfedit = 0
start()
def new():
import os
dir = raw_input("Directory?:")
os.chdir(dir)
dirprint = os.listdir(dir)
print dirprint
fnew = raw_input("File name?:")
f=open(fnew,'w')
f.write(' ')
f.close()
openf()
start()
so far only edits one line oh well
i wrote a python script in it and then i felt alll powerfull