# Python reading files (.txt, .json, .csv) # ---------- .txt ---------- file_path = "C:/Users/HP/Desktop/input.txt" try: with open(file_path, 'r') as file: content = file.read() print(content) except FileNotFoundError: print("That file was not found") except PermissionError: print("You do not have permission to read that file") # ---------- .json ---------- import json file_path = "C:/Users/HP/Desktop/input.json" try: with open(file_path, 'r') as file: content = json.load(file) print(content ) except FileNotFoundError: print("That file was not found") except PermissionError: print("You do not have permission to read that file") # ---------- .csv ---------- import csv file_path = "C:/Users/HP/Desktop/input.csv" try: with open(file_path, 'r') as file: content = csv.reader(file) for line in content: print(line) except FileNotFoundError: print("That file was not found") except PermissionError: print("You do not have permission to read that file")
@sanath88546 ай бұрын
Thanks a lot man, it helped me.
@abbymiller3 ай бұрын
BIG THANKS TO YOU
@piano_depois_dos_506 ай бұрын
Thank you.
@alexramos5876 ай бұрын
Very helpful. Thanks, Bro!
@mohsenmk25376 ай бұрын
Thank you Bro for beautiful content
@MarcsBianchini6 ай бұрын
You can you use an 'r' in front of the absolute path and let the path unchanged. like this r"C:\User\HP\Descktop".
@Quizzes-n7l6 ай бұрын
BROCODE IM A BIG BIG FAN, I learned Css and Html from you and am currently learning React.Js. BRO AM A BIG FAN THANKS ALLOT FOR TEACHING ME
@jayasan16496 ай бұрын
same here bro!thank u bro code
@pizzalawl35446 ай бұрын
yo I know you haven't done C videos in a while but could you please do a tutorial on preprocessor directives?? really need a good one right now and i can't find anything good online.
@soumyadeepghosh44286 ай бұрын
kotlin full course please man !
@somonorhong1686 ай бұрын
Brooo i wanna see your C# window tutorial video
@MarianoBustos-i1f6 ай бұрын
Thanks Bro
@robert-qn8hy6 ай бұрын
Can you please make a video on Lambda Decorators in python... 🙏
@DoomGuy911_6 ай бұрын
Came in clutch i have an exam on this tmr lol
@NazneenNaharNishi6 ай бұрын
When you will teach us the android development bro...♥♥♥♥♥♥♥♥