pcd2txt

pcd2txt

"""
Created on Tue Oct 29 22:43:59 2019

@author: sgl
"""
import os
from os import listdir, path

path_str = '/media/david/pcd'  # your directory path
txts = [f for f in listdir(path_str)
        if f.endswith('.pcd') and path.isfile(path.join(path_str, f))]

for txt in txts:
    with open(os.path.join(path_str, txt), 'r') as f:
        lines = f.readlines()

    with open(os.path.join(path_str,os.path.splitext(txt)[0]+".txt"), 'w') as f:
        f.write(''.join(lines[11:]))
发布了27 篇原创文章 · 获赞 4 · 访问量 4528

猜你喜欢

转载自blog.csdn.net/SGL_LGS/article/details/103244348