for root, directories, files in os.walk(z):
for file in files:
fullname = os.path.join(root, file)
print(fullname, os.path.getsize(fullname))
for root, directories, files in os.walk(z):
print(root)
for file in files:
fullname = os.path.join(root, file)
print(file, os.path.getsize(fullname))
import re
filename = 'asd.33.lk3.3s23120b.jpg'
m = re.match("(.+?)(\d+)?(\.[^\.]+)$", filename)
if m:
new_name = f"{m.group(1)}{int((m.group(2)) if m.group(2) else 0)+1}{m.group(3)}"
print(new_name)
Используя key:test_1 из one_dict достать словарь из two_dict по key:test_1.
Думал брать валюту как последний элемент массива, а первые два конкатенировать в 1 строку. Но это костыль какой-то, ещё и нерабочий, потому что в цифрах типа 1 000 000 $ эта логика уже не будет работать.Если символ валюты всегда один (не разбит пробелами), то вполне можно и этим методом, например:
a= '1 000 000 $'
print(''.join(a.split()[:-1]))
def select(self, sql):
return self.cursor.execute(sql).fetchone()
data = music.getall('APIC')[0].data
работает и что-то возвращает.if duplicate_two:
cur.execute('UPDATE covers_db SET Cover_Path=?, Album_Title=?, Album_Artist=?, Year_of_Publishing=? WHERE File_Path=?', (cover_path, album_title, album_artist, year_of_publishing, path))
a = [{'https': 'https://127.0.0.1:3128'}, {'https': 'https://127.0.0.18080'}, {'https': 'https://127.0.0.1:53052'}, {'https': 'https://127.0.0.1:44299'}]
a.remove({'https': 'https://127.0.0.1:53052'})
print(a)
a = ['https://127.0.0.1:3128', 'https://127.0.0.18080', 'https://127.0.0.1:53052', 'https://127.0.0.1:44299']
a.remove('https://127.0.0.1:53052')
print(a)
text = text.replace('пд','пипец')
record = cur.execute('SELECT * FROM tags_db WHERE Path=?', (path, ))
result = record.fetchall()
if not result:
# и далее ...
sql = cur.execute('SELECT * FROM tags_db WHERE path=?', (path, ) )
Что именно они хотят выводить таким образом, я не особо понял.