uk
Feedback
CBSE COMPUTER SCIENCE

CBSE COMPUTER SCIENCE

Відкрити в Telegram

QUESTION BANK, REFERENCE BOOK, LAB MANUAL , WORKSHEET ETC., PYTHON TEXT BOOK AND REFERENCE BOOKS, 01. ASK QUESTIONS AT https://t.me/joinchat/FJ1noGs-64I0OWI1

Показати більше
549
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 день
Архів дописів
demo.txt0.00 KB

Current Position is 0 The content is Hel Current Position is 3 The content is lo Wo Current Position is 0 The content is Hel Current Position is 3 The content is lo Wo Current Position is 53 The content is >>>

#FILE HANDLING : SEEK() AND TELL()in TEXT file ''' tell() : Used to get the actual position of file object seek() : Used to shift/change the position of file object to required position. Syntax : f.seek(offset, [start_from]) offset tells how may number of bytes to move forward and start_from is optional, it tells from which place we want to start. There are three possible values for start_from -- 0 :beginning of file 1 :current position of file 2 :end of file * If the argument start_from is not specified, by default it is 0 * The second parameter of the seek method is by default 0 * Reference point(start_from) at current position / end of file cannot be set in text mode except when offset is equal to 0. * Possitive index supported for only TEXT files... Eg. seek(0,0)=seek(0), seek(0,1) = move to current position, seek(0,2) = move to last position * Negative index supported for only BINARY files... ''' f1=open('demo.txt') A=f1.tell() print('Current Position is ',A) B=f1.read(3) print('The content is ',B) A=f1.tell() print('Current Position is ',A) B=f1.read(5) print('The content is ',B) #File pointer move to Beginning of the file f1.seek(0,0) A=f1.tell() print('Current Position is ',A) B=f1.read(3) print('The content is ',B) #File pointer move to the current position from beginning f1.seek(0,1) A=f1.tell() print('Current Position is ',A) B=f1.read(5) print('The content is ',B) #File pointer move to the last position from beginning f1.seek(0,2) A=f1.tell() print('Current Position is ',A) B=f1.read(5) print('The content is ',B) f1.close()

seekandtell.py0.02 KB

S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:17 PM] PYTHON : LIST-1 t.me/QuizBot?start=eowBkzeL S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:18 PM] PYTHON : LIST-2 t.me/QuizBot?start=k8DYZ3Oa S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:18 PM] PYTHON : LIST-3 t.me/QuizBot?start=Smn9ThxH S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:38 PM] List object-001 : https://forms.gle/ejQRg25vVc4ALRaX6 S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:38 PM] Tuple Object-001 : https://forms.gle/Ku6mSpzqTXhRVJBo8 S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:38 PM] String Object-001 : https://forms.gle/Yv6jhEF78TjAg5R59 S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:39 PM] Do the above and send your score.... S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:45 PM] Python Function-001 : https://forms.gle/jBRCbLw8bukPhzQy9 S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [06/01/2022 10:45 PM] Python Function-002 : https://forms.gle/tvu3GM6THFp5kU7w7

+5
Tuple_Methods.py0.01 KB

List_functions.py0.00 KB

photo content

+4
001 Ch01 P01.pdf6.42 KB

+1
INSTALLATION OF MYSQL-TERM-2.pptx9.35 KB

+1
11-CS SYLLABUS.pdf1.47 KB

#Python with Mysql import mysql.connector as mcr cn = mcr.connect(host='127.0.0.1',user='root',password="admin") cr = cn.cursor() cr.execute("create database if not exists company") cr.execute("use company") cr.execute("create table if not exists employee(empno int(12),empname varchar(50),edept varchar(30),salary decimal(12,2))") cn.commit() choice=int(input("1. ADD RECORD 2. UPDATE RECORD 3.DELETE RECORD 4. SEARCH 5.DISPLAY 6.EXIT : ")) while choice!=0: if choice==1: #INSERTING A RECORD e = int(input("Enter Employee Number :")) n = input("Enter Name :") d = input("Enter Department :") s = int(input("Enter Salary :")) query="insert into employee values({},'{}','{}',{})".format(e,n,d,s) cr.execute(query) cn.commit() print("A RECORD INSERTED...") elif choice == 2: #UPDATING A RECORD e=int(input("Enter employee number to be updated ")) s=int(input("Enter salary to be updated ")) query="update employee set salary={} where empno={}".format(s,e) cr.execute(query) print("A Record Updated ") cn.commit() elif choice == 3: #DELETING A RECORD e=int(input("Enter employee number to be deleted")) query="delete from employee where empno={}".format(e) cr.execute(query) print("Record(s) Deleted ") cn.commit() elif choice == 4: #SEARCHING A RECORD e=int(input("Enter employee number to be searched")) query="select * from employee where empno={}".format(e) cr.execute(query) result = cr.fetchall() if cr.rowcount==0: print("Record not found") else: print("EMPNO","NAME","DEPARTMENT","SALARY") for row in result: print(row[0],row[1],row[2],row[3]) cn.commit() elif choice == 5: #DISPLAYING RECORDS query="select * from employee" cr.execute(query) result = cr.fetchall() print("EMPNO","NAME","DEPARTMENT","SALARY") for row in result: print(row[0],row[1],row[2],row[3]) cn.commit() elif choice==6: #CLOSING DATABASE cn.close() print("File closed successfully...") break else: print("Invalid Choice...") choice=int(input("1. ADD RECORD 2. UPDATE RECORD 3.DELETE RECORD 4. SEARCH 5.DISPLAY 6.EXIT : "))

ONLINE SUMMER CLASSES FOR IP/CS : CONTACT - 7448862261

+1
ComputerScience-SQP_Term2.pdf7.06 KB

Computer_Science_SrSec_2022-23 (1).pdf6.31 KB

Computer_Science_Arihant_Class_12_Term_2_Sample_Papers_WWW_EXAMSAKHA.pdf54.20 MB

XII CS TERM 2 SAMPLE PAPER BOOK_2.pdf1.65 MB

IP_SQP_Class-XII-Term-2.docx_AK.pdf2.16 KB

+2
011 Database Management.pdf8.60 KB