Jul-03-2018, 07:09 AM
Hi, I wanted to create a script that can opened a text file, c_name.txt where the content of the text file would be list of cell names. After i opened, i need to assign all the cell names as a variable. This is because i need the cell name to open up the next directory which requires the cell name.
Here how it looks like in c_name.txt:
ce_ll_sum
ce_ls_sub
ce_ll_add
ce_ls_clk
Besides, the script located in workspace/test/c_name.txt while the report file is located in workspace/library/$ce_ll or $ce_ls/cell.rpt
#!/usr/bin/python import os import os.path myPWD = os.getcwd() workspace = "%s/.." %(myPWD) os.chdir(myPWD) floc = '/'.join([myPWD, "c_name.txt"]) with open(floc, "r+") as f1: cell_names = f1.readlines() for cell_name in cell_names: floc2 = '/'.join([workspace, "library", "ce_ll or ce_ls", "{0}.rpt".format(cell_name)]) with open(floc2, "r+") as f2: for line in f2: print lineFor floc2, I need to classify if cell name starts with ce_ll, then the report files will be in ce_ls directory whereas if the cell name starts with cell, then the report files will be in cell directory.
Here how it looks like in c_name.txt:
ce_ll_sum
ce_ls_sub
ce_ll_add
ce_ls_clk
Besides, the script located in workspace/test/c_name.txt while the report file is located in workspace/library/$ce_ll or $ce_ls/cell.rpt