Is there a function that I can use to find out if a file is a block device? And another for a character device. I'm trying to create a funtion that will build a string the is exactly like the result you get from running ls -l for a slightly larger program I'm working on. Maybe it would save me some time if that function already existed, what would be helpful as well. Thanks.
lewashby 56 Junior Poster
Recommended Answers
Jump to PostYou can also use subprocess to get the results of ls -l. Note the r(epr)
import subprocess output = subprocess.check_output([r'ls', '-l']) print output
Jump to Post@woooee Your program is working but it's giving me really messy output, it's all on one line an run togather. I tried pring '\n' right after the print statement but that doesn't seem to be getting the job done. Any ideas?
split it on the newline, "\n", to get a …
All 6 Replies
Gribouillis 1,391 Programming Explorer Team Colleague
woooee 814 Nearly a Posting Maven
Gribouillis 1,391 Programming Explorer Team Colleague
lewashby 56 Junior Poster
Gribouillis 1,391 Programming Explorer Team Colleague
woooee 814 Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.