|
|
import os, n2 O/ Z, e. B" l5 W8 I4 K9 l
path = r"F:\Python\task"
" t1 G0 b8 ]5 A/ {! G( |/ Lotherpath=r"F:\Python\other"
, Q8 ?7 x3 j' k# U( V" wfor filename in os.listdir(path):1 R* \7 P! ^3 d8 a8 m$ q5 p* A
print(path,filename)! Z) @5 _0 x) j3 |( h
fullname=os.path.join(path,filename)
* a/ {; u0 T- ?. U5 l if os.path.isfile(fullname): 8 B. ]: J8 \$ H
othername=os.path.join(otherpath,filename) ! G! o4 k% I! R, q1 j9 U, C
otherfile=open(othername,'wb')
& i# K( U- j: o' ^ X' ?; h; r, Q2 m for line in open(fullname,'rb'):
' I7 P, m, @$ Z9 B; v for c in line:
" t$ Z6 c5 C3 i3 K if not c.isdigit():otherfile.write(c). s* `2 {* a }- y! K3 N+ ]
otherfile.close() |
|