Найти - Пользователи
Полная версия: Узнать в каком режиме открыт файл
Начало » Python для новичков » Узнать в каком режиме открыт файл
1
svas
Можно как-нибудь узнать в каком режиме открыт файл?
Пока придумал только такой способ:
try:
f.write('test'.encode())
print('Binary mode')
except TypeError as e:
print('Test mode')
Python 3
Virtuos86
>>> file = open('bla_bla_bla', ‘w’)
>>> file.mode
'w'
>>>
svas
спасибо
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB