Найти
-
Пользователи
Полная версия:
Узнать в каком режиме открыт файл
Начало
»
Python для новичков
»
Узнать в каком режиме открыт файл
1
svas
Ноя. 13, 2011 13:56:12
Можно как-нибудь узнать в каком режиме открыт файл?
Пока придумал только такой способ:
try:
f.write('test'.encode())
print('Binary mode')
except TypeError as e:
print('Test mode')
Python 3
Virtuos86
Ноя. 13, 2011 17:27:17
>>> file = open('bla_bla_bla', ‘w’)
>>> file.mode
'w'
>>>
svas
Ноя. 13, 2011 17:44:49
спасибо
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