socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

added my first python funciton

This commit is contained in:
David 2012-05-15 23:25:27 +02:00
parent 7b79020887
commit 05cb3947ec
1 changed files with 17 additions and 7 deletions

View File

@ -4,13 +4,23 @@
import os
#reading needed files
file = open("/proc/partitions", "r")
parts = file.read()
file.close()
file = open("/proc/mounts", "r")
mounts = file.read()
file.close()
# 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
parts = fileparser("/proc/partitions")
mounts = fileparser("/proc/mounts")
partitions = []