Ask Your Question
1

newline change ascii characters in sage command

asked 2022-01-11 08:15:16 +0100

yhlee gravatar image

updated 2022-01-11 09:14:20 +0100

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-01-11 09:13:48 +0100

tmonteil gravatar image

updated 2022-01-12 10:39:27 +0100

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
edit flag offensive delete link more

Comments

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

yhlee gravatar imageyhlee ( 2022-01-12 02:05:47 +0100 )edit

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: 2022-01-11 08:15:16 +0100

Seen: 179 times

Last updated: Jan 12 '22