to_cmd_string

Contents

to_cmd_string#

to_cmd_string(unquoted_str: Any) str[source]#

Add quotes around the string in order to make the command understand it’s a string (useful with tricky symbols like & or white spaces):

Parameters:

unquoted_str (str) – String to update

Returns:

Quoted string

Return type:

str

Example

>>> # This str wont work in the terminal without quotes (because of the &)
>>> pb_str = r"D:/Minab_4-DA&VHR/Minab_4-DA&VHR.shp"
>>> to_cmd_string(pb_str)
""D:/Minab_4-DA&VHR/Minab_4-DA&VHR.shp""