I have some files (800+) in folder as shown below:
test_folder
1_one.txt
2_two.txt
3_three.txt
4_power.txt
5_edge.txt
6_mobile.txt
7_test.txt
8_power1.txt
9_like.txt
10_port.txt
11_fire.txt
12_water.txt
I want to rename all these files using python like this:
test_folder
001_one.txt
002_two.txt
003_three.txt
004_power.txt
005_edge.txt
006_mobile.txt
007_test.txt
008_power1.txt
009_like.txt
010_port.txt
011_fire.txt
012_water.txt
Can we do this with Python? Please guide on how to do this.
"_", convert to a number and add trailing zeros. Then join it again using"_".join(splitted_name).