-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmolina.py
More file actions
44 lines (30 loc) · 880 Bytes
/
molina.py
File metadata and controls
44 lines (30 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import math
import glob
def encuentra():
listArchivos = []
for nombreArchivo in glob.glob('/afs/ictp.it/home/m/mmolina/shellexample/thehackerwithin-PyTrieste-4f54727/shellExample/cleardata/*.txt'):
listArchivos.append(nombreArchivo)
return listArchivos
#print encuentra()
def buscaN(s):
f = open(s, 'r')
lineas= f.readlines()
#print lineas[4]
f.close()
return lineas[4].find('N')
def reemplazoArchivo():
listArchivos=encuentra()
for nombreArchivo in listArchivos:
posi=buscaN(nombreArchivo)
if posi!= -1:
f = open(nombreArchivo, 'r')
lineas= f.readlines()
f.close()
lineas[4].replace('N','M')
f=open(nombreArchivo,'w')
for i in lineas:
f.write(i)
f.close()
reemplazoArchivo()
#print buscaN('/afs/ictp.it/home/m/mmolina/shellexample/thehackerwithin-PyTrieste-4f54727/shellExample/cleardata/Data0559.txt')