| ���� Python �̳� | ��4�� �������� | |
|---|---|---|
| ��һҳ | �ַ��� | ��һҳ |
�ַ����� �ַ������� ���ַ��������Ͼ���һ�鵥�ʡ�
�Ҽ������Ա�֤����ÿ��Python�����ж�Ҫ�õ��ַ������������ر����������ⲿ�ֵ����ݡ���������������Python��ʹ���ַ�����
������õ�����ָʾ�ַ���������ͬ'Quote me on this'���������еĿհף����ո���Ʊ�������ԭ��������
��˫�����е��ַ����뵥�����е��ַ�����ʹ����ȫ��ͬ������"What's your name?"��
���������ţ������ָʾһ�����е��ַ�����������������������ɵ�ʹ�õ����ź�˫���š����磺
'''This is a multi-line string. This is the first line.
This is the second line.
"What's your name?," I asked.
He said "Bond, James Bond."
'''
��������Ҫ��һ���ַ����а���һ�������ţ�'������ô�����ôָʾ����ַ��������磬����ַ�����What's your name?����϶�������'What's your name?'��ָʾ������ΪPython��Ū����������ַ����Ӻδ���ʼ���δ����������ԣ�����Ҫָ�������Ŷ������ַ����Ľ�β������ͨ�� ת��� ����������������\'��ָʾ�����š���ע�������б�ܡ�����������ַ�����ʾΪ'What\'s your name?'��
��һ����ʾ����ر���ַ����ķ�����"What's your name?"������˫���š����Ƶأ�Ҫ��˫�����ַ�����ʹ��˫���ű�����ʱ��Ҳ���Խ�����ת��������⣬�������ת���\\��ָʾ��б�ܱ�����
ֵ��ע���һ�����ǣ���һ���ַ����У���ĩ�ĵ���һ����б�ܱ�ʾ�ַ�������һ�м����������ǿ�ʼһ���µ��С����磺
"This is the first sentence.\
This is the second sentence."
�ȼ���"This is the first sentence. This is the second sentence."
�������ҪָʾijЩ����Ҫ��ת����������ر������ַ�������ô����Ҫָ��һ����Ȼ�ַ�������Ȼ�ַ���ͨ�����ַ�������ǰr��R��ָ��������r"Newlines are indicated by \n"��
Unicode����д�����ı��ı��������������Ҫ�����ĸ���籱ӡ�����������д�ı�����ô����Ҫ��һ��֧��Unicode�ı༭�������Ƶأ�Python�����㴦��Unicode�ı�������ֻ��Ҫ���ַ���ǰ����ǰu��U�����磬u"This is a Unicode string."��
��ס�����㴦���ı��ļ���ʱ��ʹ��Unicode�ַ������ر��ǵ���֪������ļ������÷�Ӣ�������д���ı���
����ζ��һ���㴴����һ���ַ�������Ͳ����ٸı����ˡ���Ȼ�⿴��������һ�����£���ʵ���������ǡ����ǽ����ں���ij����п���Ϊʲô����˵������һ��ȱ�㡣
�����������ַ����������������ڷ��ţ����ǻᱻPython�Զ����������磬'What\'s' 'your name?'�ᱻ�Զ�תΪ"What's your name?"��
��C/C++����Ա��ע��
��Python��û��ר�ŵ�char�������͡�ȷʵû����Ҫ��������ͣ��������㲻��Ϊ�˶����ա�
��Perl/PHP����Ա��ע��
��ס�������ź�˫�����ַ�������ȫ��ͬ�ġ�������û�����κη����в�ͬ��
���������ʽ�û���ע��
һ��Ҫ����Ȼ�ַ��������������ʽ���������Ҫʹ�úܶ�ķ�б�ܡ����磬�������÷�����д��'\\1'��r'\1'��
| ��һҳ | ��һ�� | ��һҳ |
|---|---|---|
| �� | ��ҳ | ���� |