Answer the question
In order to leave comments, you need to log in
How to edit the conf.py file?
and so, I have a script, but it needs a lot of sessions, each number is different
when I write a number, the script must save it to a variable, after that it starts editing the code of one of the files,
but it’s bad luck how to edit this file
for example, write the number 2, then the file should be
from pyrogram import Client as session
global sess
sess = {
1: session('1'),
2: session('2'),
}
from pyrogram import Client as session
global sess
sess = {
1: session('1'),
2: session('2'),
3: session('3'),
4: session('4'),
5: session('5'),
}
Answer the question
In order to leave comments, you need to log in
Just make a shape for start and end
def func_edit_string(lenght):
form1 = '''from pyrogram import Client as session
global sess
sess = {
'''
form_inject = ''
for num in range(1,lenght+1):
form_inject += str(num)+": session('"+str(num)+"'),\n"
return form1+form_inject+"}"
a = func_edit_string(5)
print(a)
from pyrogram import Client as session
global sess
sess = {
1: session('1'),
2: session('2'),
3: session('3'),
4: session('4'),
5: session ('5'),
}
sess = {
1: "shrimp",
2: "shrimp",
}
sess.update({3: "shark"})
print(sess)
{1: 'shrimp', 2: 'shrimp', 3: 'shark'}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question