Python Forum
I am not getting any output in the Subset_soil_param.txt file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am not getting any output in the Subset_soil_param.txt file
#9
(Jan-14-2020, 08:14 AM)buran Wrote: not tested but
with open('Grid_cell.txt') as f:
    grid_cells = [line.strip() for line in f]
 
with open('original_soil_param.txt') as f, open('subset_soil_param.txt', "w") as sub_f:
    for line in f:
        cell_id = line.split(' ')[1]
        if cell_id in grid_cells:
            sub_f.write(line)

Buran, man it worked, thank you so much. Clap
Reply


Messages In This Thread
RE: I am not getting any output in the Subset_soil_param.txt file - by Baloch - Jan-14-2020, 08:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,140 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Output CSV file with filepath and file contents glittergirl 1 1,772 Aug-03-2020, 01:50 AM
Last Post: glittergirl
  csv file output rturus 7 3,328 Jan-30-2020, 02:09 PM
Last Post: buran
  File name as part of output file name Jeeping_Coder 1 2,138 Jan-10-2020, 03:43 PM
Last Post: Clunk_Head
  How to extract a matrix from .xml.gz file to a excel file or any other output? enyrb 0 2,076 Oct-21-2019, 01:01 PM
Last Post: enyrb
  python file output to log file Rsh 4 3,732 Aug-13-2019, 09:00 PM
Last Post: DeaD_EyE
  Output SQL to csv or xls file? JP_ROMANO 4 2,622 Aug-02-2019, 01:58 AM
Last Post: JP_ROMANO

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020