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 :: tkinter allign 
Python :: tqdm every new line 
Python :: non-default argument follows default argument 
Python :: drop list of columns pandas 
Python :: python hide input 
Python :: python expressions 
Python :: apply lambda function to multiple columns pandas 
Python :: qtablewidget not editable python 
Python :: pandas dataframe get number of occurrence in column 
Python :: Find Specific value in Column 
Python :: drop na dataframe 
Python :: pandas look for values in column with condition 
Python :: replace nan numpy array 
Python :: discord py import commands 
Python :: pygame mirror image 
Python :: print( n ) in python 
Python :: append value to numpy array 
Python :: python reference to back folder 
Python :: matplotlib savefig size 
Python :: how to import your own function python 
Python :: calculate mean on python 
Python :: python list elements 
Python :: pandas new column average of other columns 
Python :: python http request params 
Python :: drop first two rows pandas 
Python :: change color of text button pyqt5 
Python :: remove newline and space characters from start and end of string python 
Python :: check type of django messages 
Python :: django queryset first element 
Python :: throw error in python 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =