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