Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python open file same folder

import os
with open(os.path.join(sys.path[0], "my_file.txt"), "r") as f:
    print(f.read())
Comment

python read file from same directory

f = open(os.path.join(sys.path[0], "test.html"), "r")
print(f.read())
f.close()
Comment

PREVIOUS NEXT
Code Example
Python :: how to count post by category django 
Python :: how to make player quit in python 
Python :: openpyxl delete rows 
Python :: batch a list python 
Python :: django email settings 
Python :: waitkey in opencv 
Python :: sacar la posicion en una lista python 
Python :: how to wait in pygame 
Python :: python for i in directory 
Python :: python distance of coordinates 
Python :: mimetype error django react 
Python :: how to make all time greeter using python 
Python :: logout in discord.py 
Python :: where to find python interpreter 
Python :: select a value randomly in a set python 
Python :: unique words from pandas 
Python :: dict godot 
Python :: gow to find a letter in a word in python 
Python :: Removing all non-numeric characters from string in Python 
Python :: np random array 
Python :: python namedtuple 
Python :: oppsite of abs() python 
Python :: selenium scroll to element python 
Python :: rotational list python 
Python :: create jwt token python 
Python :: Scrape the text of all paragraph in python 
Python :: flask return html 
Python :: python how to set multiple conditional for single var 
Python :: python count lines in string 
Python :: reverse shell python 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =