I have file tbl.lua with lua table:
SpeedFM={}
SpeedFM[20000101]=0.77566
SpeedFM[20000102]=0.77569
SpeedFM[20000103]=0.7757
SpeedFM[20000104]=0.77569
Using lua I just make dofile('tbl.lua') and get this table to work with it. My question. How can I execute this file in python because this is a valid python dictionary too?
1 Answer 1
In other words you are trying to execute external file within python. As long as your tbl.lua file is a valid python file then you can use one of those:
For Python 2 use execfile:
execfile('tbl.lua')
For Python 3 use exec:
exec(open("tbl.lua").read())
Be wary though as you are stepping on a really, really thin ice.
Asking yourself what you are trying to accomplish is often the most reasonable question when you are starting analyzing problem you are facing and would help you finding answers more quickly.
python tbl.luaor you can change name totbl.pyand then you canimport tblin other script.tbl.pyand then from main Python file dofrom tbl import SpeedFM