W
W
wenzeslaus2021-09-05 16:38:18
Python
wenzeslaus, 2021-09-05 16:38:18

How to interact with characters if they are in a text notepad?

I want to interact with numbers that are written in a standard text editor - notepad.
Let's say I want to multiply a number by 200 by 2, then it turns out not 400 as usual, but 200200. How can I fix it so that I can work with numbers normally?
here is the code:

file = open(file="testtext.txt") #в файле написано число 200
file1 = file.read()
print(file1)
print(file1*2)

6134c815ce78e710298582.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Developer, 2021-09-05
@wenzeslaus

Lord, why doesn't anyone even read an elementary book?
You are working with a string data type, but it is necessary with an integer.
Bring one type to another and you will be happy.
Until the next problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question