Sure. Assuming you have a string with the file’s name called fname
, the following does the trick.
with open(fname, 'r') as fin:
print(fin.read())
More Related Contents:
- How do I parse a string to a float or int?
- How do I get the last element of a list?
- How to find all occurrences of a substring?
- Python Variable Declaration
- Weird Try-Except-Else-Finally behavior with Return statements
- Python find elements in one list that are not in the other [duplicate]
- Pandas: Get Dummies
- Repeating each element of a numpy array 5 times
- Find the item with maximum occurrences in a list [duplicate]
- Comparing previous row values in Pandas DataFrame
- Counting unique values in a column in pandas dataframe like in Qlik?
- What exactly is Python multiprocessing Module’s .join() Method Doing?
- Python file.tell() giving strange numbers?
- Redirecting stdio from a command in os.system() in Python
- Remove all items from a layout
- pygame.error “couldn’t open image.png” only in command prompt
- Link to Python with MinGW
- Using python Logging with AWS Lambda
- multiprocessing pool example does not work and freeze the kernel
- ‘virtualenv’ is not recognized as an internal or external command, operable program or batch file
- Checking if a website is up via Python
- Write a Pandas DataFrame to Google Cloud Storage or BigQuery
- Weighted random sample without replacement in python
- How to create raw string from string variable in python?
- What’s the purpose of Django setting ‘SECRET_KEY’?
- how to reload a Class in python shell?
- Why django urls end with a slash?
- Openpyxl check for empty cell
- Permission to view, but not to change! – Django
- Adding legend based on existing color series