An elegant way using pathlib.Path:
from pathlib import Path
p = Path('mysequence.fasta')
p.rename(p.with_suffix('.aln'))
More Related Contents:
- Renaming a file sequence
- Renaming column names in Pandas
- Extracting extension from filename in Python
- Rename Pandas DataFrame Index
- How can I check the extension of a file?
- Rename specific column(s) in pandas
- Convert row to column header for Pandas DataFrame,
- Removing prefix from column names in Pandas
- Rename result columns from Pandas aggregation (“FutureWarning: using a dict with renaming is deprecated”)
- Rename nested field in spark dataframe
- Batch Renaming of Files in a Directory
- Renaming multiple files in a directory using Python
- Easiest way to rename a model using Django/South?
- Python: Rename duplicates in list with progressive numbers without sorting list
- Rename columns in Pandas based on a dictionary
- multiprocessing.dummy in Python is not utilising 100% cpu
- Print a list of space-separated elements
- Why are there no ++ and – operators in Python?
- Why is Apache-Spark – Python so slow locally as compared to pandas?
- Hide traceback unless a debug flag is set
- Migrating data when changing an NDB field’s property type
- Getting started with secure AWS CloudFront streaming with Python
- How can I print a single backslash?
- How to explain the reverse of a sequence by slice notation a[::-1]
- Python packages not installing in virtualenv using pip
- Why doesn’t my pandas rolling().apply() work when the series contains collections?
- Copy directory contents into a directory with python [duplicate]
- Unable to “import matplotlib.pyplot as plt” in virtualenv
- Remove non-ASCII characters from a string using python / django
- Importing external module in single-file exe created with PyInstaller