python method for splicing file paths
- 2020-12-26 05:47:52
- OfStack
As shown below:
<code class="language-python">import os
base_dir = os.path.dirname(__file__)
# Gets the current file directory
path = os.path.join(base_dir,'123.txt')
# Gets the path of the file after splicing </code>