Hey I know this has been asked a few times, but I wrote my own code for it but it isn’t working and I don’t see why. Here is my code
def fixfiles ():
inputfilehandle = open("C:/allCHP1seq.txt","r")
outputf=open("chp1seqs.txt","w")
lines = inputfilehandle.readlines()
for line in lines:
if "c:\users" not in line:
outputf.write(line)
Here is an example of data from the file, basically theres 279 of these in the file, separated by 2 lines. But each is unique, what I need to do is get rid of the bit at the start specifying the directory.
c:\users\gary\desktop\sequences for chp1\14-3 1076.txt
>fig|6666666.13395.peg.1076
atgatcaaagaaaccgaaaaaccgccaaccaccctctttaccgtcgtccc
cgacacccctaccgaaaccctgctgatcaacagctacgaaaccgtgtgtt
ccgtcagcaccctgctgctcgacttgtccgaagacctcaccggcaaacac
cgcgatatcgccttggccattcatcagttgagcgaactgagcgtcctgct
ggtgggcaaagccatggaccagcacacaccccgctgctga
I really don’t see where I’m going wrong :/ Help!
I guess you should escape your
\:"c:\\users"instead of"c:\users".