Python Forum
modifying path in build files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
modifying path in build files
#2
Something like this maybe if I understand correctly
from pathlib import Path

path1 = Path(r'd:\foo\project\build\tools\py_automation_dev')
path2 = Path(r'd:\bah\project\build\tools\py_automation_dev')

def new_path(path):
    return Path(*path.parts[:2]).joinpath(Path(r'project\build)'))

print(new_path(path1))
print(new_path(path2))
Output:
d:\foo\project\build) d:\bah\project\build)
Reply


Messages In This Thread
modifying path in build files - by sudhirpaniyur - Jun-18-2020, 03:55 AM
RE: modifying path in build files - by Yoriz - Jun-18-2020, 12:07 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020