Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Text editing with python
#1
Hi, I have a *.txt 3d scan file in the form of x,y,z...

-43.9017 58.4327 8.0448 0.5321
-43.9031 58.4574 8.0457 0.4800
-43.9247 58.4600 8.0505 0.5794
-43.8825 58.4828 8.0390 0.5164

The problem is that the file is way too big and needs some culling ... ie it has about 2055 million point and in order for a program to read it it needs to be less than 2000 million or even less. I am a beginner in python and it shouldn't be hard but the idea is to open the file through python, delete every 50th row and save in another location. In another situation i would have sat it through and solved it myself but because it critical for my job i don't have the luxury of time.

Thanks in advance for your help.
Quote
#2
You can read it and process it line by line:

with open('big_file.txt', 'r') as f:
    for line in f:
        # do something
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Code Editing Help Rememberthecreed 2 230 Feb-08-2020, 09:56 AM
Last Post: Rememberthecreed
  Indexed position editing of a lst ShruthiLS 4 254 Sep-26-2019, 09:23 AM
Last Post: perfringo
  Editing and testing a package amasta 2 502 Mar-19-2019, 12:36 PM
Last Post: buran
  Editing Dictionaries Astrikor 7 1,032 Aug-15-2018, 05:05 PM
Last Post: Astrikor
  Parsing and Editing a Structured Text File norsemanGrey 1 676 Jul-11-2018, 09:51 PM
Last Post: Larz60+
  Help Editing/Problem with outputs stanthaman42 7 1,174 Jul-11-2018, 05:30 PM
Last Post: ichabod801
  [Discord.py] Editing messages Ouindoze 4 15,959 Oct-11-2017, 02:07 AM
Last Post: Ouindoze

Forum Jump:


Users browsing this thread: 1 Guest(s)