#
class Solution:
def simplifyPath(self , path: str) -> str:
# write code here
dirs = path.split('/')
new_path = []
for i in dirs:
if i=='..' and new_path:
new_path.pop()
elif i and i != '.' and i != '..':
new_path.append(i)
return '/'+'/'.join(new_path)



京公网安备 11010502036488号