Level 1 : What is the output of the following code?


file1 = open('sample.txt', r)
print(file1.readable())
print(file1.writable())

Author: anusha | Tags: file-handling | 1859+ Python FAQs | Share
file | namespace | matrix-list-comprehension | module | sys-module | static-method | reading-and-writing-files | loop-control-statements | list-slicing | multithreading | recursion | memory-management | namedtuple | operator | print | python-operators | reading-and-writing-large-files-efficiently | regex | slice | string-iteration | managing-directories-with-os-and-shutil | mysql | return-statement | pickling--unpickling | math-copysign | writing:-write(),-writelines() | set-operation | version | thread-synchronization | logical-operation | list-methods-and-slicing | pandas | multiprocessing | overflow | round-function | string | nested-loop | mathematical-function | thread | syntax-error | methods | quantifiers-(*,-+,-?,-{}) | package-management | mathematics | raise | min-function | opening-files-(open()) | dataframe-and-series-objects | counter | conditional-statement | data-type-conversions | defining-functions | copy | comprehension | anchors-(^,-$) | stack | access-modifier | default-arguments | parsing-with-strptime | dicts | conditional-statements | class-and-instance-variable | working-with-temporary-files-using-tempfile | pseudocode | sorting-and-ranking | scientific-notation | regular-expressions | built-in-function | name-mangling | type-conversion | booleans | advanced-file-operations | built-in-modules | syntaxerror | mutable | using-else-and-finally | data_structure | command-line-parsing | data-structure | input-function | string-slicing | file_handling | factorial-function | string-manipulation | functional-programming | while-loops | arbitrary-arguments-(*args,-**kwargs) | string-slicing | assignment-operators | control-flow | function | error | collections | else-statement | enumerate() | binary | call | bitwise-operator | escape-operator | format | iterable | datatype | filter | docstring | destructor | decimal | arithmetic-expression | goto-function | formal-and-actual-parameter | invalid-list | comparison | class | binary-operation | error-handling | list-indexing | installation | boolean-masking | integer | aggregating-data-with-functools.reduce() | indexing:-loc-vs-iloc | immutable-data-type | datetime.date,-datetime.time,-datetime.datetime | creating-custom-modules | exception-handling | global-variable | choice | file-handling | identity-operator | condition | def | data-type | comment | asyncio-module | lambdas | higher-order-function | iterators | global-variable | exponentiation | zip | single-inheritance | numeric | polymorphism | multiple-except-blocks | logical-operator | using-the-threading-module | python_version | class-and-object | id-function | control-statement | function-argument | file-handling | conditional-statement | match | basic | postfix | loop | global-keyword | integers | strings | while-loop | type-conversion | software-design | functional-programming | function-and-scope | python-history | odd-number | inheritance | operator-overloading | numpy | benefit | lambda | for | logical-operator | literal-characters-and-special-characters | recurssion | range | swapping | data-structure | filter-function | string-methods | data-structures | operations | exception | using-lists-as-stacks | heap-memory | touples | typeerror | matplotlib | objects | python-module | asyncio | creating-and-starting-threads | why-use-multiprocessing-over-threading?-(gil) | data-type | sorted | __future__ | dictionary-methods | input | python-syntax-and-structure | formatting-with-strftime | python | staticmethod | counter-function | decorator | round | input-function | list-operation | shallow-copy | descriptors | class-decorators | string-method | complex-number | list,-set,-and-dictionary-comprehensions | list-comprehension | frozenset | syntax | membership-operators-(in,-not-in) | math | working-with-file-paths | test-discovery | intering | keyword | turtle | zfill-function | else | pep | map-function | difference-between-threads-and-processes | precedence | boolean | indexing | functions | identity-operator | array | sorting | using-assertions-(assertequal,-assertraises) | init | method-overloading | threading | joining-and-merging-dataframes | import-method | control-flow | sets | __all__-attribute | application | built-in | statement | oop | working-with-binary-files-(rb,-wb) | lists | deep-copy | set | list-vs-tuple | using-map()-for-transformations | matrix | logical-operators | list-method | error-handling | object-attribute | oops | constructor | head-and-tail | tuple-unpacking | memory | dictionary | class-and-inheritance | loops | iterator | inherit | generators-in-python | list-mutation | async | rollback | loop-control | collection | method | list-join | generators | list-comprehension | regular-expression | interpreter | introduction-to-threads | __init_subclass__ | compute | max-min | unit-testing | attribute | precedence-and-associativity | reading:-read(),-readline(),-readlines() | lambda-functions | introduction-to-multiprocessing | syntax-error | bitwise-operator | yield | using-os-and-pathlib-modules | multiple-inheritance | handling-missing-values-(fillna,-dropna) | sum-function | operator-and | tuple | library | thread-safe-data-structures-(queue.queue) | introduction-to-python | fabs-function | tuples | tuple-methods | identifier | string-concatenation | python-django | python-repl | split | floats | append | data-types | magic-method | mapping-function | assignment-operator | expression | multiple-inheritance | operator-or | encapsulation | string-method | arithmetic-operation | virtual-environment | built-in-function | pass | identity-operators-(is,-is-not) | random | print-statement | datetime | slicing | string-formatting | while-and-for-loop | expand-tab | dictionaries | sum() | int | raise-statement | context-manager | sys | classes | lambda-function | operand | with-statement | virtual-environment | operators | variable | bitwise | list | generator | gil | random-function | center | exception-handling | type_conversion | complex | debugging | data-structures-in-python | filtering-and-indexing | overriding-methods | working-with-dates-and-times | directory-operations | assert | join | immutability | update | implementation | time-series-with-pandas | feature | parameter | default-mutable-argument | walking-through-directories-using-os.walk() | conversion | key-value-pairs | dictionary-comprehensions | version-check | using-join()-and-is_alive()-methods | encoding | type-conversion-and-casting | string-formatting | using-yield-in-functions | zip-function | min-max-function | floating-point-precision | global | while-else-loop | indentation | boolean-and-non-boolean | design-principle | list-comprehensions ...