added my first python funciton
This commit is contained in:
parent
7b79020887
commit
05cb3947ec
24
df_check.py
24
df_check.py
|
@ -4,13 +4,23 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
#reading needed files
|
# reading a file
|
||||||
file = open("/proc/partitions", "r")
|
def fileparser(path):
|
||||||
parts = file.read()
|
file = open(path, "r")
|
||||||
file.close()
|
result = file.read()
|
||||||
file = open("/proc/mounts", "r")
|
file.close()
|
||||||
mounts = file.read()
|
return result
|
||||||
file.close()
|
|
||||||
|
#file = open("/proc/partitions", "r")
|
||||||
|
#parts = file.read()
|
||||||
|
#file.close()
|
||||||
|
#file = open("/proc/mounts", "r")
|
||||||
|
#mounts = file.read()
|
||||||
|
#file.close()
|
||||||
|
|
||||||
|
# reading needed files
|
||||||
|
parts = fileparser("/proc/partitions")
|
||||||
|
mounts = fileparser("/proc/mounts")
|
||||||
|
|
||||||
|
|
||||||
partitions = []
|
partitions = []
|
||||||
|
|
Reference in New Issue