Как правильно проверить атрибуты доступа файла? То есть доступна ли запись в файл или является ли он исполняемым?
Для этого в Python есть функция os.access()
Проверять так:
os.access(path, flag)
Функция вернёт bool в зависимости от наличия указанного флага.
Всего есть 4 флага проверки:
os.F_OK - наличие файла на диске
os.R_OK - доступ на чтение
os.W_OK - доступ на запись
os.X_OK - доступ на исполнение
Например, вместо try-except лучше делать так (пример из документации):
if os.access("myfile", os.R_OK):
with open("myfile") as fp:
return fp.read()
#basic#libs
#AMP/USDT analysis :
#AMP is currently exhibiting an uptrend, consistently reaching new highs while trading above the 200 EMA. The price is now retracing toward the 200 EMA and a significant support level.
It is expected that the price will test this zone and subsequently rebound, which will allow the bullish momentum to persist and potentially lead to a retest of previous highs.
TF : 1D
Entry : $0.006750
Target : $0.011915
SL : $0.004950
#AMP/USDT analysis :
#AMP has broken above a previously tested resistance level and has bounced back after a retest. This suggests a continuation of its bullish momentum, with the price likely to test previous highs from the current level.
TF : 1D
Entry : $0.005420
Target : $0.013400
SL : $0.004180
#AMP has a trading range on 12H Time frame, we expect a good pump from bottom of this range,also after breakup will have another bullish movement again
📈
❄️@signals_bitcoin_crypto❄️
❄️@Shadow_support0o❄️