LoginSignup
26
17

More than 5 years have passed since last update.

os.path.joinの絶対パスの扱い

Last updated at Posted at 2014-05-25

引数に絶対パスがあると、その前の引数は無視されるので注意。

(ref. https://docs.python.org/3.3/library/os.path.html#os.path.join)

os.path.join
>>> os.path.join('/test', '/hoge', '/piyo')
'/piyo'

>>> os.path.join('/test', 'hoge', '/piyo')
'/piyo'

>>> os.path.join('/test', 'hoge', 'piyo')
'/test/hoge/piyo'
26
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
17