please bare with me as im a returning newbie and have not really used re.expression much and still get very confused!
my problem!
i am currently working on a few database records which need appending.
this is one of the files i need to resort
the data base has now changed and i need to strip the first two sections and replace with lower case ie..
S100007|S100007|
would now be
s100007|s100007|
this is the text file i have
stu_file.txt ==
S100007|S100007|Kimf|Shovctter|K.Shogdftter@UCS.AC.UK|Y|Enabled|Y|
S100038|S100038|Lxois|Macvnsfield|L.Manfdfsfield@UCS.AC.UK|Y|Enabled
S100040|S100040|Revxbecca|Harcvxcris|R.Hargrfgis@UCS.AC.UK|Y|Enabled|Y
S100076|S100076|Hocvlly|Wilkxcvins|H.Wifgkins@UCS.AC.UK|Y|Enabled|Y
and so on for about another 3000 odd lines
i can search though the whole file and remove all upper case text but i need the upper case on everything apart from the first to sections but as it only has two capitals and the rest are numbers im stuck on which way i should do it.
import sys
import string
import pprint
import re
newlist=()
inFile = open('Person_Staff.txt','r')
s = inFile.read()
oldStr = ("E.......")
newStr = ("e.......")
inFile.close()
oldlist = re.compile('oldStr').match('inFile', 1)
newlist=(str.replace(oldStr, newStr, oldlist))
outFile = open('Person_Staff.txt','w')
outFile.write(newlist)
outFile.close()
print(newlist)
this is what i have got so far but this just returns errors and i am not shore what to do next or what i haven't done yet!
any help and suggestions would be very helpful!
thanks again!