Answer the question
In order to leave comments, you need to log in
Error in Python 3 when reading from a file?
I read lines from a file and output to the command line. At the same time, when I output what I read from the file, everything works, but when I perform small manipulations with this line, an error occurs. Why, after all, in both cases strings are displayed, the variable and is not displayed?
Mistake:
IndentationError: unindent does not match any outer indentation level
f = open('stroki.txt')
for line in f:
print (line)
a = "https://site.com/desc?target="+line+"&platform=message"
print (a)
Answer the question
In order to leave comments, you need to log in
The reason was that opposite one line was indented with Tab, and the other with 4 spaces
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question