Question: I am tying to find sha1sum for an .img file and the original device. Here's the method for doing that and the output i'm getting.

Code:

```
def hashcalc(self, file_path):  
    cmd1 = ["gksudo","sha1sum",file_path]
    cmd2 = ["gksudo","sha1sum","/dev/mmcblk0"]

    proc1 = subprocess.check_output(cmd1)
    proc2 = subprocess.check_output(cmd2)

    print proc1
    print proc2

```

OUTPUT:

```
1ba1a6bbd66c335633d53d9bfff7366936e2e0e3  /home/user/Project/2gb.img
1ba1a6bbd66c335633d53d9bfff7366936e2e0e3  /dev/mmcblk0

```

Now how do I remove the path '/home/.../2gb.img' and '/dev/mmcblk0'. I want to compare those values. But normal '==' will not work as it contains the path as well. How do i remove that path. Please help.

Answer: 
Try using split and then compare:

```
proc1.split()[0] == proc2.split()[0]

```
`string.split(" ")` will split the the string by space and returns a list.
`proc1.split(" ")` will return `["1ba1a6bbd66c335633d53d9bfff7366936e2e0e3","/home/user/Project/2gb.img"]`

You can get the first value of the list which will return the required value.

```
proc1.split(" ")[0] == "1ba1a6bbd66c335633d53d9bfff7366936e2e0e3"

```