a_dict = ({"date": {"year": 2011, "month": 2, "day": 2}, "pay": 810, "cons": 174}, )
with open('tbl.json') as f:
data = json.load(f)
data["values"] += list(a_dict)
with open('tbl.json', 'w') as f:
json.dump(data, f)
Мне нужна подсказка, как дописывать существующий файл.
from collections import Counter
a = ({'Петя': 6, 'Вася': 8, 'Дима': 11, 'Юля': 3}, {'Петя': 5, 'Вася': 36, 'Дима': 4, 'Юля': 8}, {'Петя': 54, 'Вася': 21, 'Дима': 22, 'Юля': 39}, {'Петя': 61, 'Вася': 48, 'Дима': 71, 'Юля': 73})
c = Counter()
for d in a:
c.update(d)
@bot.message_handler(func=lambda m: True)
def echo_all(message):
bot.reply_to(message, message.text)
@bot.message_handler(context_types=["text"])
def send(message):
bot.send_message(431331940, "text message")
from multiprocessing.pool import ThreadPool
def editapache(self,oldmail,mail,name,oldname,charset,oldcharset,vhid):
with open(filename,'r+') as config:
map(config.replace, [oldmail, oldname, oldcharset], [mail, name, charset])
config.write(config)