hello Brython/Python/web experts
i'm new to brython and enjoying it so far
but i'm a bit stuck on something
i upload multiple text files to my server where brython is running
then i want to read those files into ONE python list
sort of like this (sorry about the whitespace/tab indentation i'm not used to doing this!)
for k in range(0,20):
print ("reading file edl{}.edl".format(str(k)))
try:
filecontents=open("edl{}.edl".format(str(k))).read().split("\r")
for thing in filecontents:
filecontentz.append(thing)
except:
pass
for line in filecontentz:
if "*" in line:
fxname=line.replace("*","").replace("ASC_SOP ","").strip()
if fxname not in fxnamez:
fxnamez.append(fxname)
else:
repeatz.append(fxname)
if len(repeatz)>1:
document['repeats'].text='\n'.join(repeatz)
alert("YOU HAVE REPEATED FX NAMES IN YOUR EDL\nplease fix them and try again...")
else:
document['repeats'].text="NO REPEATS\n CHEERS!"
basically what i want to do is take every text file,open it and put every line into a list called filecontentz
then go through every entry in filecontentz and if there is an asterisk in the line, i make a variable called fxname to hold the line in
i check to see if fxname is already in the list fxnamez and if it IS i put it in the list repeatz instead
this lets me see if the assistant editor has managed to name all his visual effects with a unique name and if not tells me what he has to "look for" to fix it
so
PROBLEM
i can't seem to get the
filecontents=open("edl{}.edl".format(str(k))).read().split("\r")
line to do anything after the first file
so i'm wondering how i would do this
I know what i do is weird - i'm not a programmer (i make tv programmes look good) but any help would be amazing
i've done this very same kind of thing as a normal python script and it works fine but there i think i do the
with open("path/to/file) as f
python trick and then it all seems to be ok
so...over to you guys
thankyou
jamie