I am trying to split a string taken from the cmd using os.system
but no matter what I split by it always returns [0]
.
import os
username = os.system("whoami /user")
username = (str(username).split(' '))
print(username)
For some reason the original output is treated as an integer but that doesn't seem to matter as it is converted to a string.
string = "This is a string"
print(string.split(' '))
This works as intended though!