I'm trying to store content of file.txt
into list
cat file.txt
dm-3
dm-5
dm-4
dm-2
here is my script:
#!/usr/bin/python
import os
import json
drives = os.system("cat file.txt")
for i in drives:
print(i)
I'm getting the following error:
Traceback (most recent call last):
File "./lld-disks2.py", line 5, in <module>
for i in drives:
TypeError: 'int' object is not iterable