Python Forum
How to load log.txt directly into python codes?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to load log.txt directly into python codes?
#1
I wrote a very simple program which can retrieve some data I need. It's then written to a txt file. It looks like the following.

Tencentlh =  ([0.675000011920929, 0.8550000190734863, 1.6699999570846558, 4.699999809265137, 6.800000190734863, 17.5, 24.079999923706055, 27.959999084472656, 30.059999465942383, 47.400001525878906, 93.0, 111.30000305175781, 132.10000610351562, 188.0, 251.39999389648438, 300.3999938964844, 325.20001220703125], [1.2699999809265137, 1.940000057220459, 5.550000190734863, 14.5600004196167, 14.40999984741211, 33.08000183105469, 38.599998474121094, 46.15999984741211, 56.20000076293945, 100.4000015258789, 134.89999389648438, 171.0, 220.8000030517578, 439.6000061035156, 476.6000061035156, 400.3999938964844, 564.0])
Then I need to do further statistics. It would be great if I can just directly load the txt file as python codes, a bit like import a function from a module, so I can directly reuse the value "Tencentlh" and of course all the other values.
How can I do that? Any help would be much appreciated.
Reply


Messages In This Thread
How to load log.txt directly into python codes? - by sparkt - Aug-18-2020, 02:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Failed attempts to load Microsoft Appstore Python DLLs piyushd 0 455 Oct-31-2023, 10:43 AM
Last Post: piyushd
  Import XML file directly into Excel spreadsheet demdej 0 880 Jan-24-2023, 02:48 PM
Last Post: demdej
  How to set LD_LIBRARY_PATH on python codes? aupres 1 8,524 Mar-25-2021, 08:49 AM
Last Post: buran
  Load table from Oracle to MYSQL using python himupant94 0 1,672 May-12-2020, 04:50 PM
Last Post: himupant94
  Get input directly as a number? Pedroski55 4 2,228 May-05-2020, 04:29 PM
Last Post: deanhystad
  Python - help with getting JSON from one DB and load to another DB qIekm 4 3,318 Apr-16-2020, 07:07 AM
Last Post: qIekm
  TypeError indexing a range of elements directly on the list JFerreira 2 2,242 Mar-30-2020, 04:22 PM
Last Post: bowlofred
  problem with mapnik in anaconda python 2: from _mapnik import * ImportError: DLL load parsley 0 1,924 Dec-11-2019, 07:50 AM
Last Post: parsley
  python and load balancer pythonFresher 1 2,300 Jul-18-2019, 07:23 AM
Last Post: pythonFresher
  Fatal Python error: Py_Initialize: unable to load the file system codec ecg1g15 0 3,595 Feb-12-2019, 12:16 PM
Last Post: ecg1g15

Forum Jump:

User Panel Messages

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