Not able to read simple text file

import pandas as pd

# Path to the text file
file_path = r'C:/5G_Documents/sus.txt'  # Make sure to use 'r' before the string to treat it as a raw string

# Read the data from the text file into a DataFrame
try:
    df = pd.read_csv(file_path, sep='\t', header=None)  # Adjust 'sep' parameter accordingly if needed
    print(df)
except FileNotFoundError:
    print("The file does not exist or the path is incorrect.")

It says file not found

Hey @susbose10!

You need to upload the file to Replit for it to be able to see the file, it can’t read your local computer.

Hey @Firepup650 , thanks
can you tell me how to upload the text file or where to upload in replit

If you click on the three dots on the top of the file tree, there should be an Upload files option.

Got it. Many Thanks for quick help

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.