Quote:
Code:
# -*- coding: utf-8 -*- Code:
runfile('C:/Users/HP/a.py', wdir='C:/Users/HP') Seems there is no way to install natsort on spyder, as got this impression after extensive googling. On restarting kernel, and applying other means, finally got to the below command:, which also didn't work: Code:
install natsort Code:
--------------------------------------------------------------------------- But, even these results seem not to help. |
You might be able to install it via pip but I don't know if spyder will automatically know it exists. Regardless of sorting your original code was just renaming files without really knowing what you were actually renaming. From the code it seems like all you want to do is replace the first "." with "_". What don't you use string replace and search for a "1." (to pickup the first "." and replace it with a "1_"
|
Quote:
Please tell if should make a separate post about the installation of natsort, on Anaconda? |
Yes, you can create a new thread on natsort module.
However, looking at it from a new angle.. Code:
import os Quote:
Code:
old file name: 1.2.png |
Look. Honestly, you should solve this by renaming the images. You need to zero-pad the numbers. Assuming the numbers go into the dozens, 1_1.png would need to be renamed to 1_01.png. If they go into the hundreds, then it becomes 1_001.png.
If you can’t just save out another image sequence with the proper padded numbering, then you can use Python to do the renaming. I can give you help with that, if you need it. |
All times are GMT -5. The time now is 11:28 AM. |