Suppose from index.py
with CGI, I have post file foo.fasta
to display file. I want to change foo.fasta
's file extension to be foo.aln
in display file. How can I do it?
import os
thisFile = "mysequence.fasta"
base = os.path.splitext(thisFile)[0]
os.rename(thisFile, base + ".aln")
Where thisFile = the absolute path of the file you are changing