How do i read line from an input file, without the /n

D

doritrieur

How do i read line from an input file, without the /n ?
the readline function returns also the /n character at the end. i need
to read a line without the training /n
is this possible?

thanks, Dorit
 
A

Aggelos Orfanakos

f.readline().rstrip('\n') should do it. If you are sure that lines
always end in '\n', then you could even use f.readline()[:-1]
 
D

doritrieur

thanks all for your replies! it did helped me!
by the way, i am really new to phyton and to programming, can anyone
refer me to an online source that supplies the relevant data for syntax
ect?

thanks, Dorit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,274
Messages
2,571,366
Members
48,051
Latest member
noblesalt

Latest Threads

Top