Level 1 : What happens if the file is not found in the following Python code?


a=False
while not a:
    try:
        f_n = input("Enter file name")
        i_f = open(f_n, 'r')
    except:
        print("Input file not found")

Author: HareramG | Tags: exception-handling | 1736+ Python FAQs | Share
head-and-tail | slicing | attribute | object-attribute | data-structure | turtle | mysql | else-statement | encoding | list-comprehension | data_structure | regular-expression | filter | id-function | raise | asyncio | dictionary | factorial-function | init | docstring | min-function | type-conversion | data-structures | string-method | comment | random | version | exception | logical-operator | filter-function | list-operation | bitwise | python_version | matplotlib | lambda | context-manager | python-django | binary-operation | bitwise-operator | precedence | enumerate() | input-function | comprehension | function-argument | design-principle | integer | software-design | static-method | inheritance | list-vs-tuple | append | function | staticmethod | def | immutability | map-function | assignment-operator | import-method | indentation | random-function | generator | format | with-statement | match | virtual-environment | formal-and-actual-parameter | postfix | expand-tab | objects | lambdas | typeerror | classes | immutable-data-type | bitwise-operator | operator-and | method | name-mangling | pickling-&-unpickling | center | python-repl | error | string-method | invalid-list | boolean-and-non-boolean | operators | conditional-statement | yield | frozenset | collections | memory-management | numeric | int | input-function | call | loops | descriptors | operand | math | syntax | precedence-and-associativity | generators-in-python | command-line-parsing | sum() | for | pep | zip | magic-method | assert | module | zfill-function | error-handling | gil | range | functional-programming | round | datetime | while-and-for-loop | implementation | identity-operator | pseudocode | set | library | list-slicing | global-keyword | join | __future__ | tuple | stack | global-variable | sum-function | arithmetic-operation | python | multiple-inheritance | statement | control-flow | string-slicing | print-statement | sys-module | feature | recursion | benefit | constructor | multiprocessing | function-and-scope | round-function | fabs-function | deep-copy | string-slicing | arithmetic-expression | exception-handling | global-variable | choice | string-concatenation | thread | python-history | expression | installation | multithreading | identity-operator | control-flow | file-handling | pandas | indexing | loop | asyncio-module | operator-or | namespace | string-iteration | basic | floating-point-precision | syntaxerror | identifier | version-check | sys | list-indexing | string-manipulation | dictionaries | decimal | mutable | class-and-instance-variable | matrix-list-comprehension | exception-handling | mathematics | list-method | matrix | datatype | goto-function | list-join | counter | copy | boolean | binary | inherit | class-and-inheritance | syntax-error | built-in-function | dicts | split | conversion | built-in-function | parameter | collection | syntax-error | shallow-copy | type_conversion | scientific-notation | async | global | mathematical-function | complex-number | tuple-unpacking | python-module | return-statement | iterator | max-min | rollback | destructor | variable | input | compute | regex | while-loop | namedtuple | keyword | encapsulation | string-formatting | numpy | class | heap-memory | iterable | oops | logical-operation | zip-function | type-conversion | lambda-function | mapping-function | list | threading | array | math-copysign | recurssion | sorting | update | nested-loop | operator | string-formatting | overflow | debugging | string | control-statement | oop | swapping | __init_subclass__ | polymorphism | data-type | file_handling | memory | comparison | functions | loop-control | data-structure | data-type | __all__-attribute | decorator | default-mutable-argument | touples | virtual-environment | operations | sorted | methods | lists | min-max-function | class-and-object | logical-operator | interpreter | generators | access-modifier | package-management | complex | while-else-loop | print | list-comprehension | higher-order-function | file-handling | operator-overloading | exponentiation | built-in | condition | escape-operator | file | application | conditional-statement | slice | set-operation | counter-function | odd-number | list-mutation ...