C
C
Chinato2021-07-07 04:33:21
Python
Chinato, 2021-07-07 04:33:21

How to take data from one file and replace it in another?

I have two files: accounts.json and info (any extension).

The accounts.json file contains the “email”, “password” data:

[{"email": "example_email", "password": "example_password"},
{"email": "example_email", "password": "example_password"},
{"email": "example_email", "password": "example_password"},
…}]


The second file, info, has multiple emails and one password for all emails:


Email:
[email protected]
[email protected]


Password:
password


Or:

Login: [email protected]
Password: password

Login: [email protected]
Password: password


Question: How is it possible, using Python or JavaScript, to take each [email protected] and password, then replace "example_email" and "example_password" in the accounts.json file?

I apologize if I couldn’t convey something, I can’t formulate ...

In short: you need to take data from the list and paste it into another file, replacing certain text, in my example, this text: example_email and example_password.

Why exactly these two EPs? Because it is a helper file for other Python programs.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question