file_exists
file_exists(path)Test if a file exists
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| path | Union[str, List[str]] | Path to a file or a list of files | required |
Returns
| Name | Type | Description |
|---|---|---|
| Union[bool, List[bool]] | the result of the call to os.path.exists or a list of these results in case path is a list |
Examples
>>> from rlike import *
>>> x = tempfile(pattern = 'hello', fileext = '.txt')
>>> test = file_exists(x)
>>> test
True
>>> test = file_remove(x)
>>> test = file_exists(x)
>>> f1 = writeLines(text = 'Hello world. Some more text.', con = 'fname1.txt')
>>> f2 = writeLines(text = 'Hello world. Some more text.', con = 'fname2.txt')
>>> test = file_exists([f1, f2])
>>> test
[True, True]
>>> test = file_remove([f1, f2])
>>> test
[None, None]