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