Skip to content
Snippets Groups Projects
Commit 7635929f authored by hdd29's avatar hdd29
Browse files

parsing README (no check for file type), iterate through all dirs

parent 59b14caf
Branches
No related tags found
No related merge requests found
#!/usr/bin/env python 3
import sys
import os
top = sys.argv[1]
IND = ' '
os.chdir(top)
rootPath = os.getcwd()
for root, dirs, files in os.walk(top):
os.chdir(root)
currentDir = os.getcwd()
exists = os.path.isfile(str(currentDir)+ '/README')
if exists:
print('Found it!')
else:
print('Uh uh, no REDME for you!')
os.chdir(rootPath)
def createDirXML():
dirXML=open('dir.xml', 'w+')
dirXML.close()
with open('dir.xml', 'a') as dirXML:
dirXML.write('<?xml version="1.0" encoding="ISO-8859-1"?> \n <direntry>')
#if exist README in that folder
#!/usr/bin/env python3
RM = open('README', 'r')
line_list = RM.readlines()
RM.close()
for l in line_list:
w = l.split(':')
if str(w[0]) == 'index':
last=w[-1].strip('\n')
index=w[1:(len(w)-1)]
index.append(last)
elif str(w[0]) == 'required':
w[-1].strip('\n')
last=w[-1].strip('\n')
required=w[1:(len(w)-1)]
required.append(last)
print('required list is' + str(required))
print('index list is' + str(index))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment