2007c234 g O .bss 00000004 servo_turner_claw2
2007c140 g O .data 00000004 _impure_ptr
2007c000 g .data 00000000 _data
2007c5bc g .bss 00000000 _pvHeapStart
00010c4c g F .text 00000018 open_claw2()
2007c1bc g .data 00000000 _edata
00010278 g F .text 00000004 operator new(unsigned int)
2007c0dc g O .data 00000004 __ctype_ptr__
2007c5ac g O .bss 00000004 __malloc_sbrk_start
2007c5b0 g O .bss 00000004 __malloc_free_list
00010c9c g F .text 00000024 rotate_claw2_anticlkwise()
预期输出为
^{pr2}$
我写的密码是f = open("final_lst.txt", "r+")
g = open("Filtered_lut.txt", "w+")
filter_list = ["int","unsigned"]
for line in f:
if ".data" in line :
columns = line.split(" ")
columns.insert(0, "va")
g.write(" ".join(columns)+"\t")
if ".text" in line:
if "(" in line:
for word in filter_list:
columns = line.split(" ")
columns.insert(0, "vi")
g.write(" ".join(columns)+"\t")
if "()" in line:
columns = line.split(" ")
columns.insert(0, "vv")
g.write("\t".join(columns)+"\t")
f.close()
g.close()
在Pandas的DataFrame中添加一行或者一列,添加行有 df.loc[] 以及 df.append() 这两种方法,添加列有 df[] 和 df.insert() 两种方法, 下面对这几种方法的使用进行简单介绍。
采用 loc[] 方法多适用于对空的dataframe循环遍历添加行,这样索引可以从0开始直到数据结果,不会存在索引冲突的问题。
不过在使用insert的过程中发现 454: DeprecationWarning: `input_splitter` is deprecated since IPython 7.0, prefer `input_transformer_manager`. status, indent_spaces = self.shell.input_splitter.check_complete(code) 这个提示,猜测是有别的地方出问题了,还需要调试。
主要参考资料:
百度会吞缩进,我发其他网站了。paste.ubuntu
# 安装
while True:
try:
import openpyxl
break
except:
print('未安装openpyxl库,正在安装')
from os import system
system('pip install -i https://pypi.tuna.tsinghua.edu.cn/simple openpyxl')
# 保存xlsx
def save_xlsx(list1,path):
# 创建一个excel工作簿
wb = openpyxl.Workbook()
# 创建之后可以通过active获取默认的第一个
ws1 = wb.active
# 通过append来添加一行数据
for conten in list1:
ws1.append(conten)
# 保存
wb.save(path)
# 读取xlsx
def read_xlsx(path):
# 打开文件:
excel = openpyxl.load_workbook(path)
# 获取sheet,索引获取
table = excel.get_sheet_by_name(excel.get_sheet_names()[0])
# 返回数据
return list(map(list,table.values))
# 1-75循环生成器
def loop(s,e):
i = s
while True:
if i == e:
i = s
yield i
i += 1
if __name__ == '__main__':
path = 'D://book.xlsx' # 文件路径
l = loop(1,75) # 左闭右开,不包括75
datas = read_xlsx(path) # 读取文件
# 处理数据,不确定是不是有多个数字的情况,这里按多个数字写的
lins = None
for row in datas[1:]:
if lins != row[0]: # 判断的数字在哪一列?索引值
lins = row[0]
l = loop(1, 75)
row.append(l.__next__())
save_xlsx(datas,path) # 覆盖保存新文件
print('完成')