'How to convert a string element to a int variable from a list?
I am quite new to python and have an issue where I am going to return an
Solution 1:[1]
This should help you!
import subprocess
import re
import pwd
def sizeofhome(int):
try:
for line in pwd.getpwall():
if int == line[2]:
path = line[5]
q = subprocess.check_output(["sudo", "du", "-sm", path]).decode()
q = re.split("\s", q)
number = int(q[0])
return(number)
except:
return None
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abdul Salam |
