Suppose I have a file on /home/ashraful/test.txt. I just just want to open the file. Now my question is:
which one is good practice?
Solution 1:
dir = "/home/ashraful/"
fp = open("{0}{1}".format(dir, 'test.txt'), 'r')
Solution 2:
dir = "/home/ashraful/"
fp = open(dir + 'test.txt', 'r')
In both cases, I can open the file.
Thank:)
source
share