0

I want to read a file which has this info in the beginning which I do not need

REGRESS_OPTIONS {
-directed=1
-rocket_run_args =+ " +QDSP6_AXIM2_PRESENT=1 +AXIM2_LOWER_ADDR=0x30000000 +AXIM2_UPPER_ADDR=0x40000000"
-rocket_run_args =+ " +maxTime=1000000 +disableAllIntDrivers=1 +disableL2DirtyEntryCheck=1"
-rocket_run_args =+ " +enableVregPreload=2 +enableQregPreload=2"
-rocket_run_args =+ " +clkRandomEnable=0 +clkTypPeriod_CORE_CLK=1000 +clkTypPeriod_AXIM_CLK=1000 +clkTypPeriod_AXIS_CLK=1000 +clkTypPeriod_AHBM_CLK=1000"
-rocket_run_args =+ " +clkTypPeriod_VPE_ASYNC_CLK=1000"
-rocket_run_args =+ " +randomizeSTID=0"
# Adding option to allow NMI exception 
-rocket_run_args =+ " +allow_nmi_exception=1 "
# Adding option to true sharing limited to a single register
-rocket_run_args =+ "+enableReferenceCheckTrust=T0:R2,T1:R2,T2:R2,T3:R2,T4:R2,T5:R2" 
-rocket_run_args =+ " +pktidMonitor=1 +schedStallMonitor=1 +set_log_level=trace +max_error=5"
-postgen = "echo QDSP6_WS_TAG=$QDSP6_WS_TAG; $WORKSPACE/verif/core/sim/scripts/perf/get_wave_args.py wave_start 1 wave_stop 1"
-prereport = "$WORKSPACE/verif/core/sim/scripts/perf/get_perf_result.py"
}

I want to read the file to buffer after discarding this part

my idea is to do it this way

with open (file_path,'r') as file:

    next(file) for 16 times 
    lines=file.readlines()        

I know its a bad idea. So please suggest me a better way to do this

5

1 Answer 1

1

You could do that using Slicing:

with open (file_path,'r') as file:
   content = file.readlines()

   # you may also want to remove empty lines
   content = [l.strip() for l in content if l.strip()]

   # slice through first 16 lines    
   for line in content[16:]: 
        print(line)       
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.