On Nov 18, 9:26 am, Robocop <btha...@physic s.ucsd.eduwrote :
The "extra" newline is inserted by the print statement. To see
unambiguously what you've got, do
print repr(line)
Yes. It's part of the line (if it exists; the last line in a file may
not have a newline at the end).
I'm running some stupid little script that's supposed to alert me if
some fuse link exists. All i do is read in /proc/mounts and look to
match the fuse mount command in question, i'm doing this:
>
output = open("/www/htdocs/hatProductAdd/add/output.txt", "a")
for line in fileinput.input (['/proc/mounts']):
output.write(li ne)
if line == 'sshfs#r...@web site.com:/usr/home/sites/www.website.com/
web/PICTURES/django /www/htdocs/hatProductAdd/media/images/PICTURES/
django fuse rw,nosuid,nodev ,user_id=0,grou p_id=0,max_read =65536 0 0':
print "it's mounted"
else:
print "it's not mounted"
>
For some reason though, it never properly matches the fuse line, even
if it's there. When i straight up print the lines as they're read i
see "/proc/mounts", but every line has an extra newline between them.
some fuse link exists. All i do is read in /proc/mounts and look to
match the fuse mount command in question, i'm doing this:
>
output = open("/www/htdocs/hatProductAdd/add/output.txt", "a")
for line in fileinput.input (['/proc/mounts']):
output.write(li ne)
if line == 'sshfs#r...@web site.com:/usr/home/sites/www.website.com/
web/PICTURES/django /www/htdocs/hatProductAdd/media/images/PICTURES/
django fuse rw,nosuid,nodev ,user_id=0,grou p_id=0,max_read =65536 0 0':
print "it's mounted"
else:
print "it's not mounted"
>
For some reason though, it never properly matches the fuse line, even
if it's there. When i straight up print the lines as they're read i
see "/proc/mounts", but every line has an extra newline between them.
unambiguously what you've got, do
print repr(line)
Should i be trying to mtch the newline character as well?
not have a newline at the end).