Nov-25-2017, 05:39 PM
You have a other thread about the same here.
When no Path is give to
When no Path is give to
test.txt
the python script must be in same folder as test.txt
.foo\ |-- test.text --> hello world |-- my_script.py
# my_script.py game = open("test.txt", "r") gameboard = game.read() game.close() print(gameboard)
Output:hello world
Give Path to a other folder.# my_script.py game = open("C:/bar/test2.txt", "r") gameboard = game.read() game.close() print(gameboard)
Output:I am test2 in folder bar