Computer Science, asked by saurabhsinghchamyal, 8 months ago

write the output of the python code.

assuming user enter 5 and 65
a = raw_input ("enter a number")
b = raw_input ("enter an another
number")
print (a+b) ​

Answers

Answered by Devullas12
0

Answer:

Here

Explanation:

There are a couple of ways to check if a file exists or not. First method is use open() function on a file and see if it raises any exception. If the file is indeed existing, the open() function will be executed correctly. However, if it doesn’t, an exception will be raised.

>>> try:

file=open(filename)

print ('the file exists')

file.close()

except:

print ('file is not existing')

You can also use exists() method of path object defined in os module.

>>> from os import path

>>> path.exists(filename)

Here filename should be a string containing name along with file’s path. Result will be True if file exists otherwise false.

Python library consists of pathlib module. You can also check if file exists or not by using exists() method in this module as follows:

>>> import pathlib

>>> file=pathlib.Path(filename)

>>> file.exists()

Similar questions