Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)
How can I upload not uploaded files? For example, an image file in jupyter notebook or is there any code to upload such files in jupyter notebook? I have searched on the internet but didn't find an answer. Can anyone guide me?

1 Answer

0 votes
by (36.8k points)
edited by

You can do that for example, if you want to upload a text file and read its contents then you can use the code below:

with open("the/path/of/file.txt", "r") as file:

    text = file.read()

If you want to upload an image file in jupyter then you can use the code below:

image = cv2.imread("the/path/of/the/image/picture.png)

 Learn Data Science with Python Course to improve your technical knowledge.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers

501 comments

104k users

Browse Categories

...