M.O.S. Studios Posted August 28, 2020 Share Posted August 28, 2020 Hey everyone, I’m pretty new to python, but have done a lot of coding with php and JavaScript. here is what I am hoping to do. i want to write a script that will do the following: 1. scan sub directory make an array with the names of each of the files 2. iterate through the files using the array, and make either a object, or a function using the file name (without the extension) as the name, and the contents for the code 3. Run the function/create object that were just created, and with known variables I’m pretty sure I can figure out step one and three. It’s step two that’s giving me problems. I tried using the open() function, and eval(), but it’s giving me some problems, and that feels like a ‘janky’ way to do it. this is for a raspberry Pi project I’m using to control the equipment on my fish tank. The idea is I can write code for each sensor individually, and the program will automatically be able to incorporate it. I’d just have to drop it into the folder any suggestions? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.