0
A='abcdef'

print 'My sequence is %r' % A

The output is:

My sequence is 'abcdef'

I want to get a result like this:

My sequence is abcdef

How can I avoid quotes?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
cc1000ml
  • 67
  • 1
  • 1
  • 7

1 Answers1

1

It's because of how %r instructs Python to insert your string with a particular formatting.

You can read more about this here

To insert a string in another string, use the %s option.

Better yet, do:

"my sequence is {}".format(A)
Community
  • 1
  • 1
Torxed
  • 22,866
  • 14
  • 82
  • 131