Python Forum
Selecting special values in txt file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting special values in txt file
#1
Hello everyone,

Somme may remember a similar thread ...

I have txt files with the following structure :

Name = [102, 22]_[152, 32]_?_-20_-20
Mach = 0; Re = 2000000; T.U. = 1.0; T.L. = 1.0
Surface Finish = 0; Stall model = 0; Transition model = 1; Aspect Ratio = 0; ground effect = 0
?   Cl  Cd  Cm 0.25 T.U.    T.L.    S.U.    S.L.    L/D A.C.    C.P.
[°] [-] [-] [-] [-] [-] [-] [-] [-] [-] [-]
0.0 -2.868  0.02003 1.113   1.521   1.772   1.523   1.963   -143.170    0.250   0.638
Where the "?" sign (first line) can be 1,0 or -1.
I want to select the name of the file and the Cl and Cd values (-2.868 and 0.02003 in this particular case).
For know I used to convert the text into a string and did some slicing to get the name and the values.
But since "?"can be negative, this method doesn't work (slicing boundaries change) !!
Do you know an easy way to solve this problem ?
Thanks in advance,
Scientifix
Reply


Messages In This Thread
Selecting special values in txt file - by Scientifix - May-01-2018, 02:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selecting first and last row in python sudhirkaukuntla 2 2,510 Oct-01-2019, 06:12 AM
Last Post: sudhirkaukuntla

Forum Jump:

User Panel Messages

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