This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#hotem managemnet system | |
client_list={1:"harry",2:"carry",3:"danny"} | |
lock_list={1:"exercise",2:"food"} | |
import datetime | |
def gettime(): | |
return datetime.datetime.now() | |
def lock(op): | |
for key,value in lock_list.items(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#docstring | |
def functio1(): | |
"""this is function take two number and sum them""" | |
num1=1 | |
num2=2 | |
sum=num1+num2 | |
print(sum) | |
print(functio1.__doc__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#try except | |
try: | |
num1=int(input("enter the number")) | |
num2=int(input("enter the second number")) | |
sum=num1+num2 | |
print(sum) | |
except Exception as e: | |
print("wrong input") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Hotel management System | |
#3 CLIENT name | |
#total 6 files exercise and food for all three CLIENT | |
#write a function which takes and retrive the value | |
import datetime | |
def gettime(): | |
return datetime.datetime.now() | |
def take(name): | |
if name==1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Hotel management System | |
#3 CLIENT name | |
#total 6 files exercise and food for all three CLIENT | |
#write a function which takes and retrive the value | |
import datetime | |
def gettime(): | |
return datetime.datetime.now() | |
def take(name): | |
if name==1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#opening file using block | |
with open("deep.txt") as f: | |
print(f.read()) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#seek(),tell() | |
f=open('deep.txt') | |
print(f.tell()) #it will tell the pointer of file | |
print(f.readline()) | |
print(f.tell()) | |
print(f.seek(0)) #it will reset the pointer of file | |
print(f.readline()) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#read and write both at same time | |
f=open("deep.txt","r+") | |
print(f.read()) | |
f.write("\ndeep here") | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#If you want to check the numbverr of character in filr use this code | |
f=open("deep1.txt","a") | |
a=f.write("\nhow are you") | |
print(a) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#appending new content in file | |
f=open("deep1.txt","a") | |
f.write("\nhow are you") | |
f.close() |