Free Energy | searching for free energy and discussing free energy

Open Source Software => Open Source application software for your PC => Topic started by: ayeaye on October 13, 2018, 06:42:50 AM

Title: Python online compiler
Post by: ayeaye on October 13, 2018, 06:42:50 AM
I looked at quite a few. Then found the following, and it appeared to be good.

https://trinket.io/python/403945f28d (https://trinket.io/python/403945f28d)

The code can be edited, which is the most important for the purpose. One cannot provide a standard input data, which is bad. But one can provide an input file. The solution is to name it always "input.txt". So the example that i provided earlier, that inputs and outputs a list, becomes the following.

Quote
a = 1.2
f = open("input.txt")
for s in f:
   print(float(s) + a)
f.close()

What was added is only file open and file close, and the file is always the same. The black triangle above there, runs it.

Title: Re: Python online compiler
Post by: ayeaye on November 04, 2018, 08:08:42 PM
To get some idea, parse a csv line from oscilloscope output, using the function nextt().

Quote
def nextt(sl, separator):
  endp = sl[0].find(separator)
  if (endp == -1): endp = len(sl[0])
  tok = sl[0][: endp]
  sl[0] = sl[0][endp + 1 : ]
  return tok

csv = ["-8.800000e-07,-0.0335937,27.7188,29.9703,0.00242187,,-8.800000e-07,1.40625e-06"]
while (csv[0] != ""):
  print(csv)
  print(nextt(csv, ","))

Output.

Quote
['-8.800000e-07,-0.0335937,27.7188,29.9703,0.00242187,,-8.800000e-07,1.40625e-06']
-8.800000e-07
['-0.0335937,27.7188,29.9703,0.00242187,,-8.800000e-07,1.40625e-06']
-0.0335937
['27.7188,29.9703,0.00242187,,-8.800000e-07,1.40625e-06']
27.7188
['29.9703,0.00242187,,-8.800000e-07,1.40625e-06']
29.9703
['0.00242187,,-8.800000e-07,1.40625e-06']
0.00242187
[',-8.800000e-07,1.40625e-06']

['-8.800000e-07,1.40625e-06']
-8.800000e-07
['1.40625e-06']
1.40625e-06

Trinket.

https://trinket.io/python/7b6e01a541 (https://trinket.io/python/7b6e01a541)