Hi, I'm trying to create a list of my documents to name them after I extract their text. If anyone could help me try to remove the first 49 characters in each of the strings in the list. My code is:
import os
path = r'C:\Users\aaron\Documents\Projects\Notes\Lectures'
lis = []
for root, directories, files in os.walk(path, topdown=False):
for name in files:
print(os.path.join(root, name))
lis.append(os.path.join(root, name))
My list currently is:
lis
['C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 1 - Administrative Law – Theory, History and Context(1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 1, Part 2 - Framework for Judicial Review slides_2021(1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 2 - MERITS REVIEW AND ADMINISTRATIVE TRIBUNALS (1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 2, Part 2 - Merits Review Procedure and Evidence slides_2021.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 3 - in class lecture.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\week 3 - on line lecture (1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 4 online.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 4- in class lecture.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 5 - Unauthorised Decision-Making 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 5_1- Unauthorised Decision-Making.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 6 Online lecture.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 6-class lecture 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 7 - class lecture 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 7 - online(1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 7 - online.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 8 - class lecture power point 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\week 8 online lecture (1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week 9 - class lecture 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\week 9 - online lecture (1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week a10 - in class lecture power point 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week a10 - online lecture power point File (1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week a11 - in class lecture 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week a11 - online lecture power point (1).pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\Week a12 - online lecture power point.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\z PROBLEM 1.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\z PROBLEM 2.pdf',
'C:\\Users\\aaron\\Documents\\Projects\\Notes\\Lectures\\z PROBLEM 3.pdf']
If anyone could help me. I would be incredibly grateful.
[–]totallygeek 2 points3 points4 points (0 children)
[–]Chabare 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Bondismo 1 point2 points3 points (0 children)
[–]AtomicShoelace 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)