0

The title sums it up, what is the difference between __file__ and os.path.realpath(__file__)?

import os

print((__file__)) #/Users/tom/Documents/Code/Python/LearnPython/playingname.py
print(os.path.realpath(__file__)) #/Users/tom/Documents/Code/Python/LearnPython/playingname.py
print(type(__file__)) #<class 'str'>
print(type(os.path.realpath(__file__))) #<class 'str'>

Is os.path.realpath redundant?

Ch3steR
  • 19,076
  • 4
  • 25
  • 52

0 Answers0