minor changes
This commit is contained in:
parent
c6df15c609
commit
e8db800831
23
changeFilenames.py
Normal file
23
changeFilenames.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Pythono3 code to rename multiple
|
||||
# files in a directory or folder
|
||||
|
||||
# importing os module
|
||||
import os
|
||||
|
||||
|
||||
path = 'neural_network\\images\\potatoes\\'
|
||||
def main():
|
||||
for count, filename in enumerate(os.listdir(path)):
|
||||
dst = 'potato' + str(count) + ".jpg"
|
||||
src = path + filename
|
||||
dst = path + dst
|
||||
|
||||
# rename() function will
|
||||
# rename all the files
|
||||
os.rename(src, dst)
|
||||
|
||||
|
||||
# Driver Code
|
||||
if __name__ == '__main__':
|
||||
# Calling main() function
|
||||
main()
|
Loading…
Reference in New Issue
Block a user