我是python的初学者,我尝试使用它来自动化重复的任务。我正在努力完成以下任务:我有一大堆文本文件,格式如下: 如何从以下文本行中删除:
Cluster -44 -58 +36 :
248 voxels (69%) covering 5% of atlas.sLOC l (Lateral Occipital Cortex, superior division Left)
51 voxels (14%) covering 5% of atlas.AG l (Angular Gyrus Left)
62 voxels (17%) covering 0% of atlas.not-labeled
Cluster -38 -84 +18 :
163 voxels (47%) covering 3% of atlas.sLOC l (Lateral Occipital Cortex, superior division Left)
49 voxels (14%) covering 0% of atlas.not-labeled
Cluster -42 -6 +30 :
89 voxels (34%) covering 2% of atlas.PreCG l (Precentral Gyrus Left)
1 voxels (0%) covering 0% of atlas.IFG oper l (Inferior Frontal Gyrus, pars opercularis Left)
创建以下数据帧:
|x|y|z|voxels|voxels_pct|covering_pct|atlas|
|-|-|-|------|----------|------------|-----|
|-44 |-58 |+36|248|69|5|sLOC l (Lateral Occipital Cortex, superior division Left)|
|-44 |-58 |+36|51|14|5|AG l (Angular Gyrus Left)|
|-44 |-58 |+36|62|17|0|not-labeled|
|-38 |-84 |+18|163|34|3|sLOC l (Lateral Occipital Cortex, superior division Left)|
|-38 |-84 |+18|49|14|0|not-labeled|
|-42 |-6 |+30|89|34|2|PreCG l (Precentral Gyrus Left)|
|-42 |-6 |+30|1|0|0|IFG oper l (Inferior Frontal Gyrus, pars opercularis Left)|
替换以下代码中的文件路径
希望这对你有用。它获取文件路径,读取和转换数据,然后使用第二个函数将其写出
使用是:
相关问题 更多 >
编程相关推荐