Some I managed to fix temporarily as below, might be useful for others. Also please correct me if anything wrong or for any improvements in the below
cmd = "blkid -o export %s" % partition_path out = self._helper.execute_cmd_output_string(cmd) var = out.split("TYPE=", 1)[1] quoted = re.compile('(?<=^\")[^"]*') for string in quoted.findall(var): return string On Wed, Nov 7, 2018 at 1:39 PM Chris Angelico <ros...@gmail.com> wrote: > On Wed, Nov 7, 2018 at 11:36 PM Qian Cai <c...@gmx.us> wrote: > > > > srinivasan <srinivasan....@gmail.com> wrote: > > > Even after changing as per the below > > > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > > > or: > > > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > > > or: > > > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > > > > > Still my output is: > > > */dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"* > > > > > > My expected output should be only: > > > *vfat* > > > > > > Could you guys please do the needful? > > > > > > > > Perfect place to use sed instead of grep/cut. > > ... or to use subprocess.check_output() to run just the blkid command, > and then do the parsing in Python. > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list