Python Forum
Creating multiple lists from file without long for loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating multiple lists from file without long for loop
#3
You can try this
with open(path.join(args.target_input_directory,'target_combined.dat'),'r') as target_file:
    next(target_file) # <- skip header line
    columns = list(zip(*(line.split(10)[:10] for line in target_file)))
Reply


Messages In This Thread
RE: Creating multiple lists from file without long for loop - by Gribouillis - Jan-28-2018, 09:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Decoding lat/long in file name johnmcd 4 396 Mar-22-2024, 11:51 AM
Last Post: johnmcd
  python convert multiple files to multiple lists MCL169 6 1,568 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Help creating shell scrip for python file marciokoko 10 1,383 Sep-16-2023, 09:46 PM
Last Post: snippsat
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,693 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Creating csv files from Excel file azizrasul 40 5,721 Nov-03-2022, 08:33 PM
Last Post: azizrasul
  Creating list of lists, with objects from lists sgrinderud 7 1,669 Oct-01-2022, 07:15 PM
Last Post: Skaperen
  Creating a loop with dynamic variables instead of hardcoded values FugaziRocks 3 1,505 Jul-27-2022, 08:50 PM
Last Post: rob101
  Multiple Loop Statements in a Variable Dexty 1 1,212 May-23-2022, 08:53 AM
Last Post: bowlofred
  Multiple user defined plots with secondary axes using for loop maltp 1 1,466 Apr-30-2022, 10:19 AM
Last Post: maltp
  Creating file with images BobSmoss 1 1,398 Jan-08-2022, 08:46 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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