例1: public class Test { public static void main(String[] args) { String s = "'sds gdasda" + "\n" + "edaeafd'"; System.out.println("转换前:"+s); s = s.replaceAll("\r|\n", ""); System.out.println(&quo
我们先来看几个例子: 例1: public class Test { public static void main(String[] args) { String s = "'sds gdasda" + "\n" + "edaeafd'"; System.out.println("转换前:"+s); s = s.replaceAll("\r|\n", ""); System.out.
In [18]: c = '你好' In [20]: d = c.encode('unicode_escape') In [21]: d Out[21]: b'\\u4f60\\u597d' In [23]: e = d.decode('utf-8') In [24]: e Out[24]: '\\u4f60\\u597d' In [25]: type(e) Out[25]: str In [26]: f = e.encode('utf-8').decode('unicode_escape')