How can I list all .desktop files in usr/share/applications using 'ls /usr/share/applications' command and make it a list variable in python3.7?
like
list1 = replayof('command')
print1 = list(list1)
print(print1)
How can I list all .desktop files in usr/share/applications using 'ls /usr/share/applications' command and make it a list variable in python3.7?
like
list1 = replayof('command')
print1 = list(list1)
print(print1)
It's not trivial to understand your question, and it's probably the wrong stackexchange for this, because it's more python than Ubuntu.
That being said, I believe the code you are looking for is
Unless your question is really about how to list all files that end in
.desktop
? Then it would bels /usr/share/applications/*.desktop
.For more on this, you may want to look into
wildcards
andglobbing
.I'll leave the list part as an exercise to the reader.