Advertisement

06.18.2008 at 12:03PM PDT, ID: 23496449
[x]
Attachment Details

How can I print string without end of line character?

Asked by pmnox in Python Scripting Language

Tags: Python

I'm trying to write a script that print first 50 numbers separated by , without any spaces, end of line characters between number. How can I do that?
I tried to use:
print ",",
however it generates extra space between wordsStart Free Trial
1:
2:
3:
4:
5:
6:
#!/usr/bin/python
 
for i in range(1,51):
	if i > 1:
		print ","
	print "%d" % i
[+][-]06.18.2008 at 12:59PM PDT, ID: 21816542

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Python Scripting Language
Tags: Python
Sign Up Now!
Solution Provided By: clockwatcher
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.18.2008 at 01:04PM PDT, ID: 21816578

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628