Bash 您是否希望python表达式len(“\n”)和len(\\n”)的值为?当您打印列表/数组时,python/node.js向您显示了什么?我补充了一个更长的答案。 $ node -p 'process.argv' $SHELL '$SHELL' \t '
您是否希望python表达式Bash 您是否希望python表达式len(“\n”)和len(\\n”)的值为?当您打印列表/数组时,python/node.js向您显示了什么?我补充了一个更长的答案。 $ node -p 'process.argv' $SHELL '$SHELL' \t ',bash,shell,argv,Bash,Shell,Argv,您是否希望python表达式len(“\n”)和len(\\n”)的值为?当您打印列表/数组时,python/node.js向您显示了什么?我补充了一个更长的答案。 $ node -p 'process.argv' $SHELL '$SHELL' \t '\t' '\\t' [ 'node', '/bin/bash', '$SHELL', 't', '\\t', '\\\\t' ] $ python -c 'import sys; print sys.argv' $SHELL '$SHELL'
len(“\n”)
和len(\\n”)
的值为?当您打印列表/数组时,python/node.js向您显示了什么?我补充了一个更长的答案。
$ node -p 'process.argv' $SHELL '$SHELL' \t '\t' '\\t'
[ 'node', '/bin/bash', '$SHELL', 't', '\\t', '\\\\t' ]
$ python -c 'import sys; print sys.argv' $SHELL '$SHELL' \t '\t' '\\t'
['-c', '/bin/bash', '$SHELL', 't', '\\t', '\\\\t']
$ echo $SHELL '$SHELL' \t '\t' '\\t'
/bin/bash $SHELL t \t \\t
python -c 'import sys; print sys.argv' $SHELL '$SHELL' \t $'\t' $'\\t'
['-c', '/bin/bash', '$SHELL', 't', '\t', '\\t']
\a alert (bell)
\b backspace
\e
\E an escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\' single quote
\" double quote
\nnn the eight-bit character whose value is the octal value nnn (one to three digits)
\xHH the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
\uHHHH the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH (one to four hex digits)
\UHHHHHHHH the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits)
\cx a control-x character
>>> print("x")
x
>>> print(["x"])
['x']
>>> print("\\")
\
>>> print(["\\"])
['\\']
$ node -p '"\\"'
\
$ node -p '["\\"]'
[ '\\' ]
$ quote=\"
# $quote is a single character:
$ echo "${#quote}"
1
# $quote prints out as a single quote, as you would expect
$ echo "$quote"
"
# If you needed a representation, use the 'declare' builtin:
$ declare -p quote
declare -- quote="\""
# You can also use the "%q" printf format (a bash extension)
$ printf "%q\n" "$quote"
\"
some_utility \" "\"" '\"'