Тёмный
No video :(

error handling in python | Lec-23 

MANISH KUMAR
Подписаться 21 тыс.
Просмотров 1,5 тыс.
50% 1

In this video, I have talked about the fundamentals of programming and Python. If you complete this, you will be well-versed in using tuples for different use cases.
Directly connect with me at:- topmate.io/man...
Save this data into file:-
id,name,age,gender
1,"Manish",26,"M"
2,"Rohan",13,"M"
3,"Simaran",35,"F"
5,"Manish,26,"M"
4,"Rohan",13,"M"
Discord channel:- / discord
For more queries reach out to me on my below social media handle.
Follow me on LinkedIn:- / manish-kumar-373b86176
Follow Me On Instagram:- / competitive_gyan1
Follow me on Facebook:- / manish12340
My Second Channel -- / @competitivegyan1
Interview series Playlist:- • Interview Questions an...
My Gear:-
Rode Mic:-- amzn.to/3RekC7a
Boya M1 Mic-- amzn.to/3uW0nnn
Wireless Mic:-- amzn.to/3TqLRhE
Tripod1 -- amzn.to/4avjyF4
Tripod2:-- amzn.to/46Y3QPu
camera1:-- amzn.to/3GIQlsE
camera2:-- amzn.to/46X190P
Pentab (Medium size):-- amzn.to/3RgMszQ (Recommended)
Pentab (Small size):-- amzn.to/3RpmIS0
Mobile:-- amzn.to/47Y8oa4 ( Aapko ye bilkul nahi lena hai)
Laptop -- amzn.to/3Ns5Okj
Mouse+keyboard combo -- amzn.to/3Ro6GYl
21-inch Monitor-- amzn.to/3TvCE7E
27-inch Monitor-- amzn.to/47QzXlA
iPad Pencil:-- amzn.to/4aiJxiG
iPad 9th Generation:-- amzn.to/470I11X
Boom Arm/Swing Arm:-- amzn.to/48eH2we
My PC Components:-
intel i7 Processor:-- amzn.to/47Svdfe
G.Skill RAM:-- amzn.to/47VFffI
Samsung SSD:-- amzn.to/3uVSE8W
WD Blue HDD:-- amzn.to/47Y91QY
RTX 3060Ti Graphic card:- amzn.to/3tdLDjn
Gigabyte Motherboard:-- amzn.to/3RFUTGl
O11 Dynamic Cabinet:-- amzn.to/4avkgSK
Liquid cooler:-- amzn.to/472S8mS
Antec Prizm FAN:-- amzn.to/48ey4Pj

Опубликовано:

 

29 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
@ShubhamRai06
@ShubhamRai06 3 месяца назад
very well explained.
@VivekKhare-z1m
@VivekKhare-z1m Месяц назад
file_path = "assignment6.txt" unique_name = set() try: with open(file_path, 'r') as file: file_contents = file.read().strip() if not file_contents: raise ValueError("File is empty it doesn't contain any data") else: for line in file_contents.splitlines(): if line.startswith("id,name,age,gender"): continue parts = line.split(',') name = parts[1].strip('"') unique_name.add(name) logger.info(f"Unique names in the file: {unique_name}") except Exception as e: logger.info(e)
@vishnu000001
@vishnu000001 3 месяца назад
Hi Manish, def find_distinct_name(file_path,action): try: file = open(file_path, action) lines = file.read().splitlines() name = [] if len(lines)==0: raise Exception("the file is empty") else: for i in range(1,len(lines)): line = lines[i] words = line.split(",") name.append(words[1]) name_list = set(name) print(name_list) except Exception as e: print(e) find_distinct_name("details.txt", "r") o/p = {'"Manish"', '"Rohan"', '"Simaran"', '"Manish'} when reading the file using read option. All the lines are getting converted into strings and when i use split method to get list from lines. I am getting data as "Manish" and "Manish, instead of error. Please let me know if there is a way to read data from txt file along with data type.
@abhijeetsinghbatra8143
@abhijeetsinghbatra8143 6 дней назад
def cal(): try: li = [] with open('file.txt','r') as handler: next(handler) fc = handler.read().strip() if not fc: raise ValueError('File is empty') for i in fc.splitlines(): st = i.split(',')[1] if not st.startswith("'") and not st.endswith('"'): print(st) raise ValueError("Name not quoted") tt = st.replace('"','') li.append(tt) print(list(set(li))) except FileNotFoundError: print('FIle is wrong') raise Exception("Please check path") except TypeError: print('Type Error') raise TypeError("Plx check type") except Exception as e: print(e) else: print('here') finally: print('OOS') try: cal() except Exception as e: print(e)
@sharadsonwane6594
@sharadsonwane6594 3 месяца назад
👍
@ankitdhurbey7093
@ankitdhurbey7093 3 месяца назад
import pandas as pd def unique_values(path, column_name): try: df = pd.read_csv(path) name = df[f"{column_name}"] return set(name) except FileNotFoundError: print("The File is not available at given path") raise Exception("Please check the path provided") except KeyError: raise Exception("Please provide the correct column name") except Exception as e: if (str(e) == 'No columns to parse from file'): raiseException('The file is empty, No columns found') try: output = unique_values(path="C:/Desktop/NewFolder/names.csv",column_name="name") except Exception as e: print(e) print(f"The list of unique values are : {list(output)}")
@bhargavnagineni9322
@bhargavnagineni9322 3 месяца назад
Hi bro.. can you please share the topics required in python for data engineer
@parthmm
@parthmm 3 месяца назад
sir how to practice python for data analyst
@safiadawood5637
@safiadawood5637 3 месяца назад
import os filename = r'C:\Users\homeuser\Documents\de prjs\Python\manish\user_info.txt' name_list = [] try: if os.path.getsize(filename) == 0: raise Exception("Empty File") else: with open(filename,'r') as handler: # read next line next(handler) # rstrip to remove '/n at end of line, split at , and name is at position 1 for line in handler: name_element = line.rstrip().split(',')[1] if not(name_element.startswith('"') and name_element.endswith('"')): raise ValueError(f"Name is not properly quoted : {name_element}") name_list.append(name_element) print(set(name_list)) handler.close() except FileNotFoundError: print("File cannot be opened: ", filename) except ValueError as e: print(e) except Exception as e: print(e)
@hardeepcharak
@hardeepcharak 3 месяца назад
Is that you in DP?
Далее
configuration file handling in python | Lec-24
35:50
Просмотров 1,3 тыс.
Oh No! My Doll Fell In The Dirt🤧💩
00:17
Просмотров 12 млн
AES encryption in python | Lec-25
22:58
Просмотров 1 тыс.
dictionary comprehension in python | Lec-15
31:34
Просмотров 1,5 тыс.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
Shahrukh Khan BEST REPLY To Arnab Goswami INSULT
3:27
Object Oriented Programming in python
1:08:29
Просмотров 64 тыс.