git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hi how do I import files inside a txt file?


Hi

How do i import files inside a txt file if they exist in the current directory?

Here is the current code but I dont know how to do it correctly.

import paho.mqtt.client as mqtt
from mqtt import *
import importlib
import os
import os.path
# from stateMachine import *

with open("list_of_devices.txt", "r") as reader:
	for item in reader:
		try:
			os.getcwd()
			print("hi")
		except:
			print("error")

This is "list_of_devices.txt":
test1,test2

Each name refers to a python file.

Thanks
Spencer