有需求:

预留,先上代码:

 import os

 def Table_Space(file_name,lis_out,tab_num = 4):
file_str = open(file_name,"r").read()
if "\t" in file_str:
lis_out.append(file_name)
print(file_name)
open(file_name,"w").write(file_str.expandtabs(tab_num)) def Cyc_Fold(Fold_F,list_out):
for i in os.listdir(Fold_F):
if os.path.isdir(os.path.join(Fold_F,i)):
Cyc_Fold(os.path.join(Fold_F,i),list_out)
if os.path.isfile(os.path.join(Fold_F,i)) and (i.startswith("app") or i.startswith("hmi")) and (i.endswith(".c") or i.endswith(".h")):
Table_Space(os.path.join(Fold_F,i),list_out) if __name__ == "__main__":
list_out = []
Fold_in = input("Please input folder:")
Cyc_Fold(Fold_in,list_out)
file_out_name = os.path.join(Fold_in,"Modify_out.txt")
file_out = open(file_out_name,"w")
for i in list_out:
file_out.write(i + "\n")
file_out.close()

python table转空格的更多相关文章

  1. python 中去除空格的方法

    python 中去除空格的方法: def trim(s): l=[] for i in s: if i!=' ': l.append(i) return ''.join(l) 其中可以使用下面的 '' ...

  2. python中使用空格还是使用 Tab键缩进的建议

    对于程序员来说,其实Tab和空格远远不只是“立场”问题那么简单. 在不同的编辑器里tab的长度可能不一致,所以在一个编辑器里用tab设置缩进后,在其它编辑器里看可能缩进就乱了.空格不会出现这个问题,因 ...

  3. python学习:python文件中空格和换行符的捕获和文本文件的转存

    0. 背景 之前公司的项目中,需要在嵌入式系统中实现一个http的网页端内容,由于项目历史遗留问题,公司是采用的将html文件转成c语言头文件的方式,每次修改页面端都需要从新编译一下程序,非常的繁琐. ...

  4. selenium3 + python - table定位

    前言 在web页面中经常会遇到table表格,特别是后台操作页面比较常见.本篇详细讲解table表格如何定位. 一.认识table 1.首先看下table长什么样,如下图,这种网状表格的都是table ...

  5. Python去除多余空格

    今天做爬虫时.发现结果中好多多余的空格.然后有强迫症的我当然不会放过 " xyz ".strip() # returns "xyz" " xyz &q ...

  6. python: 字符串按空格分成列表split与加密密码maketrans

    #字符串按空格分成列表split() print("fu li mei".split()) #split按空格分成列表 print("1+a+2+b".spli ...

  7. python之~【空格】可不能随便加唷~

    上个礼拜学习从.proto文件转xxpb2.py文件的时候,明明成功了的. 结果周末的时候在家里,以及今天周一来到公司电脑,都遇到同样的一个问题. 我就纳闷了.这个路径确实存在呀. 而且我找遍了搜索引 ...

  8. python去除html空格

    如下面的 <td> 柳暗花溟</td> html里面的空格&nbsp,想直接用strip()函数去除是不可能的,必须显式的去掉\xa0 例如以上的就可以这样的方式去除空 ...

  9. No.14 selenium for python table表单

    table表单,HTML中的特征 标识性标签:table.tr.th.td 定位使用Xpath定位 点击表格中的元素即可

随机推荐

  1. [LeetCode] Integer Break 整数拆分

    Given a positive integer n, break it into the sum of at least two positive integers and maximize the ...

  2. [LeetCode] Minimum Path Sum 最小路径和

    Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...

  3. 浅谈javascript面向对象

    我们常用的两种编程模式 POP--面向过程编程(Process-oriented programming) 面向过程编程是以功能为中心来进行思考和组织的一种编程方法,它强调的是系统的数据被加工和处理的 ...

  4. javascript正则表达式(RegExp)简述

    首先我们来思考以下两个个场景 我们使用window操作系统,有时候需要找一个文件,刚刚好这个文件我不知道放哪里去了,这个时候我们该怎么办呢? 我们使用word写论文的时候,不小心将"订价&q ...

  5. Linux配置JDK1.7和Resin4.0

    1.安装JDK1.7 (1)下载 官网下载路径:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-18802 ...

  6. [转]如何设置eclipse中js默认打开为java Editor

    打开window-preference -> General-Editors-File Associator 看到右边的.js下边就是设置默认打开方式了 转自百度知道:http://zhidao ...

  7. windows server 2008 各版本号下载地址(微软官网)

    前言: 微软官网上下载系统的镜像文件要远比百度网盘下载起来得更快. Windows Server 2008 32-bit Standard(标准版)

  8. ERwin® Data Modeler介绍

    Erwin是一个非常优秀数据建模工具,详细信息请参考百科与官网,在国内关于Erwin的资料不多,最有价值的还属于2004年出版的<erwin数据建模>:其他诸如各种文库的ppt与word文 ...

  9. ADO.net

    五大对象: 1.Connection(连接数据库) 2.Command(执行T-SQL语句) 3.DataAdapter(用户填充DataSet,断开模式) 4.DataReader(读取数据库,一种 ...

  10. ReactNative 告别CodePush,自建热更新版本升级环境

    微软的CodePush热更新非常难用大家都知道,速度跟被墙了没什么区别. 另外一方面,我们不希望把代码放到别人的服务器.自己写接口更新总归感觉安全一点. so,就来自己搞个React-Native A ...