Re: How to print without spaces?

2009-09-18 Thread Wolfgang Rohdewald
On Friday 18 September 2009, koranthala wrote:
> What if I want to print 1 to 100 in a loop without spaces in
>  between? I think that is the OPs question.

arr = ['a', 'b', 'c', 'andsoon']
print ''.join(arr)

-- 
Wolfgang
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to print without spaces?

2009-09-18 Thread Jerry Hill
On Fri, Sep 18, 2009 at 4:16 PM, koranthala  wrote:
> What if I want to print 1 to 100 in a loop without spaces in between?
> I think that is the OPs question.

In that case I would skip using print entirely, and use something like this:

import sys
for i in xrange(100):
sys.stdout.write(str(i))
sys.stdout.write('\n')

That allows you to bypass any of the behavior of the print builtin
that you don't want.

-- 
Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to print without spaces?

2009-09-18 Thread koranthala
On Sep 18, 9:49 pm, "Andreas Tawn"  wrote:
> > Hi,
>
> > I don't want to print the space between 'a' and 'b'. Could somebody
> > let me know how to do it?
>
> > Regards,
> > Peng
>
> > $ python
> > Python 2.5.2 (r252:60911, May 21 2008, 10:08:24)
> > [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> print "a","b"
> > a b
>
> print "a" + "b"
>
> Cheers,
>
> Drea

What if I want to print 1 to 100 in a loop without spaces in between?
I think that is the OPs question.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to print without spaces?

2009-09-18 Thread Tobiah

> I don't want to print the space between 'a' and 'b'. Could somebody let me
> know how to do it?

 print "a","b"
> a b

Since you are new, you should also be aware of:

print "%s%s" % (a, b)


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to print without spaces?

2009-09-18 Thread Donn
print "a"+"b"

\d
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: How to print without spaces?

2009-09-18 Thread Andreas Tawn
> Hi,
> 
> I don't want to print the space between 'a' and 'b'. Could somebody
> let me know how to do it?
> 
> Regards,
> Peng
> 
> $ python
> Python 2.5.2 (r252:60911, May 21 2008, 10:08:24)
> [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print "a","b"
> a b

print "a" + "b"

Cheers,

Drea
-- 
http://mail.python.org/mailman/listinfo/python-list


How to print without spaces?

2009-09-18 Thread Peng Yu
Hi,

I don't want to print the space between 'a' and 'b'. Could somebody
let me know how to do it?

Regards,
Peng

$ python
Python 2.5.2 (r252:60911, May 21 2008, 10:08:24)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "a","b"
a b
-- 
http://mail.python.org/mailman/listinfo/python-list