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