Ask Your Question
1

newline change ascii characters in sage command

asked 3 years ago

yhlee gravatar image

updated 3 years ago

tmonteil gravatar image

HI. I have a question

I wrote the command in my ubuntu 20.04 sage version 9.2

like this

./sage -c "print('test', '%s' %('\\angle FAC')

and then I received answer

test ngle FAC

The sage command was executed on the Ubuntu server, and '\a' turned into an ascii character.

How can I prevent the text from being converted?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 3 years ago

tmonteil gravatar image

updated 3 years ago

slelievre gravatar image

You can escape for shell and Sage:

./sage -c "print('test', '%s' %('\\\angle FAC'))"

This will output :

test \angle FAC

Or escape only for the shell, and use a raw string for Sage:

$ ./sage -c "print('test', '%s' % (r'\\angle FAC'))"
test \angle FAC
Preview: (hide)
link

Comments

Thanks. By the way, Is there any other way?

yhlee gravatar imageyhlee ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 191 times

Last updated: Jan 12 '22