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?
index.py
foo.fasta
foo.aln
An elegant way using pathlib.Path:
from pathlib import Path p = Path('mysequence.fasta') p.rename(p.with_suffix('.aln'))
1.4m articles
1.4m replys
5 comments
57.0k users