Python Programming for Biology: Bioinformatics and Beyond



Download 7,75 Mb.
Pdf ko'rish
bet449/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   445   446   447   448   449   450   451   452   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

Escape sequences

The following are some of the most commonly used escape sequences  in  Python,  which

allow  you  to  specify  textual  characters  or  control  codes  when  they  are  not  available  as

regular symbols.




Code

Description

Example

\

A backslash character, which needs to be



forced when the following character would

otherwise form an escape code.

text = ‘\title’

Text is ‘\title’ and does

not have a tab (\t) code

inside.


'

A single quote, which may need to be escaped

in situations where it should not be considered

as the start or end of a string.

text = ‘Don't do that!’

Note: not required

when a string is defined

with double quotes.

"

A double quote, which may need to be escaped



in situations where it should not be considered

as the start or end of a string.

text = “Shout "Help!"

loudly.”


Note: not required

when a string is defined

with single quotes.

\n

A newline (linefeed) control character. Used to



separate lines of text in Unix- and Linux-based

computers

text = ‘Line A\nLine

B\n’


Text value is split into

two lines on Linux and

Unix machines.

\r

A carriage return control character. Used in



combination with \n on Windows-based

systems to separate lines of text.

text = “Line A\r\nLine

B\r\n”


Text is split into two

lines on Windows

machines.

\t

A tab character, providing indentation with



whitespace to pre-set stop points.

text = ‘Col 1\tCol

2\tCol 3\n’

Tabs indent to form

three columns.

\u….


Specifies a Unicode character using a 16-bit

hexadecimal value.

text = u’\u03b1-helix’

Creates ‘α-helix’, e.g.

for graphical displays.

\x..


Specifies a character using a hexadecimal

value.


text =

‘\x48\x65\x6C\x6C\x6f’

Text is hexadecimal

code for ‘Hello’.



Constants


The  following  are  the  commonly  used  named  constants.  From  Python  3  these  become

keywords, and thus are a reserved part of the language and may not be redefined.




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   445   446   447   448   449   450   451   452   ...   514




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish