with open('file','r') as f:
text = f.read()
RewriteRule (.*) /index.php?text=$1 [L]
$_SERVER['REQUEST_URI']
https://howdyho.net/windows-software/displayhdr-test-protestiruj-svoj-monitor
Загружается только один файл -- документ. Остальные файлы загружаются по другим адресамimport win32api
#==============================================================================
def getFileProperties(fname):
#==============================================================================
"""
Read all properties of the given file return them as a dictionary.
"""
propNames = ('Comments', 'InternalName', 'ProductName',
'CompanyName', 'LegalCopyright', 'ProductVersion',
'FileDescription', 'LegalTrademarks', 'PrivateBuild',
'FileVersion', 'OriginalFilename', 'SpecialBuild')
props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}
try:
# backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc
fixedInfo = win32api.GetFileVersionInfo(fname, '\\')
props['FixedFileInfo'] = fixedInfo
props['FileVersion'] = "%d.%d.%d.%d" % (fixedInfo['FileVersionMS'] / 65536,
fixedInfo['FileVersionMS'] % 65536, fixedInfo['FileVersionLS'] / 65536,
fixedInfo['FileVersionLS'] % 65536)
# \VarFileInfo\Translation returns list of available (language, codepage)
# pairs that can be used to retreive string info. We are using only the first pair.
lang, codepage = win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation')[0]
# any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle
# two are language/codepage pair returned from above
strInfo = {}
for propName in propNames:
strInfoPath = u'\\StringFileInfo\\%04X%04X\\%s' % (lang, codepage, propName)
## print str_info
strInfo[propName] = win32api.GetFileVersionInfo(fname, strInfoPath)
props['StringFileInfo'] = strInfo
except:
pass
return props
AttributeError: 'str' object has no attribute 'act'
import os
# Импортируем glob для нахождения файлов в папке.
from glob import glob
# Папка, в которой находятся файлы.
folder = 'file'
# Директория.
filedir_ = __file__
filename_ = os.path.basename(filedir_)
basedir_ = filedir_.replace(filename_, '')
# Список всех файлов с расширением .py в папке folder.
files = glob(fr'{basedir_}{folder}\*.py')
# Своеобразное импортирование из файлов.
for file in files:
code_in_file = open(file, 'r', encoding='utf8').read()
exec(code_in_file, globals())
# Выводим переменные.
print(var_1)
print(var_2)
print(var_3)
# -*- coding: utf-8 -*-
import telebot
from time import time
import os
bot = telebot.TeleBot(token_test)
@bot.message_handler(content_types=['voice'])
def voice_processing(message):
file_info = bot.get_file(message.voice.file_id)
downloaded_file = bot.download_file(file_info.file_path)
with open(f'{message.chat.id}_{int(time())}.ogg', 'wb') as new_file:
new_file.write(downloaded_file)
@bot.message_handler(commands=['start'])
def voice_send(message):
l_send = [filename for filename in os.listdir() if filename.startswith(f'{message.chat.id}')]
for f in l_send:
voice = open(f'{f}', 'rb')
bot.send_voice(chat_id=message.chat.id, voice=voice)
if __name__ == "__main__":
try:
bot.polling(none_stop=True)
except Exception as e:
print(e)