printing dynamically string in one line in python

Posted by EngHamoud on Stack Overflow See other posts from Stack Overflow or by EngHamoud
Published on 2012-06-16T14:19:11Z Indexed on 2012/06/16 15:16 UTC
Read the original article Hit count: 181

Filed under:
|
|
|

I'm trying to print strings in one line.

I've found solutions but they don't works with windows correctly.

I have text file contains names and I want to print them like this

name=john then change john to next name and keep name=, I've made this code but didn't work correctly with windows:

op = open('names.txt','r')
print 'name=',
for i in op.readlines():
    print '\r'+i.strip('\n')

thank you for your time

© Stack Overflow or respective owner

Related posts about python

Related posts about command-line