+ 1

how can I count the characters in each line without the /n

file = open("/usercode/files/books.txt", "r") file.close()

8th Jan 2022, 6:55 AM
Mostafa Ahmad
Mostafa Ahmad - avatar
3 Answers
+ 2
You can also print a line except the last line without last character. str(len(line)-1))
8th Jan 2022, 7:41 AM
JaScript
JaScript - avatar
+ 1
until know I dont take the function strip in the course
8th Jan 2022, 7:21 AM
Mostafa Ahmad
Mostafa Ahmad - avatar
0
You can use strip() function.
8th Jan 2022, 7:04 AM
JaScript
JaScript - avatar