chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
5099f508-a2b6-429b-bbb8-6d14f5adc962
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,144
supabase-export-v2
c4782969456bce1f
note: low number ports are usually reserved for "well known" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits). Finally, the argument to ``listen`` tells the socket library that we want it to queue up as many as 5 connect requests (the normal max) before refusing outside connections...
trusted_official_docs
CPython Docs
note: low number ports are usually reserved for "well known" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits). Finally, the argument to ``listen`` tells the socket library that we want it to queue up as many as 5 connect requests (the normal max) before refusing outside connections...
note: low number ports are usually reserved for "well known" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits). Finally, the argument to ``listen`` tells the socket library that we want it to queue up as many as 5 connect requests (the normal max) before refusing outside connections...
python, official-docs, cpython, P0
Local_Trusted_Corpus
565295e1-5529-471a-9e20-ba0cd9489789
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,143
supabase-export-v2
7365fd72d0749b7d
one that was only visible within the same machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any address the machine happens to have. A second thing to note: low number ports are usually reserved for "well known" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits)...
trusted_official_docs
CPython Docs
one that was only visible within the same machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any address the machine happens to have. A second thing to note: low number ports are usually reserved for "well known" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits)...
one that was only visible within the same machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any address the machine happens to have. A second thing to note: low number ports are usually reserved for "well known" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits)...
python, official-docs, cpython, P0
Local_Trusted_Corpus
63ff1757-08c4-42d9-bff6-cad55b4ba1f4
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,135
supabase-export-v2
1934bc338f741cab
platform, there are likely to be other forms of IPC that are faster, but for cross-platform communication, sockets are about the only game in town. They were invented in Berkeley as part of the BSD flavor of Unix. They spread like wildfire with the internet. With good reason --- the combination of sockets with INET mak...
trusted_official_docs
CPython Docs
platform, there are likely to be other forms of IPC that are faster, but for cross-platform communication, sockets are about the only game in town. They were invented in Berkeley as part of the BSD flavor of Unix. They spread like wildfire with the internet. With good reason --- the combination of sockets with INET mak...
platform, there are likely to be other forms of IPC that are faster, but for cross-platform communication, sockets are about the only game in town. They were invented in Berkeley as part of the BSD flavor of Unix. They spread like wildfire with the internet. With good reason --- the combination of sockets with INET mak...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6a180d4f-23e6-40ee-99cb-f4239858ac7e
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,165
supabase-export-v2
d7102eb1e716e4f2
receiving code that gets more complex. (And in C, it's not much worse, except you can't use ``strlen`` if the message has embedded ``\0``\ s.) The easiest enhancement is to make the first character of the message an indicator of message type, and have the type determine the length. Now you have two ``recv``\ s - the fi...
trusted_official_docs
CPython Docs
receiving code that gets more complex. (And in C, it's not much worse, except you can't use ``strlen`` if the message has embedded ``\0``\ s.) The easiest enhancement is to make the first character of the message an indicator of message type, and have the type determine the length. Now you have two ``recv``\ s - the fi...
receiving code that gets more complex. (And in C, it's not much worse, except you can't use ``strlen`` if the message has embedded ``\0``\ s.) The easiest enhancement is to make the first character of the message an indicator of message type, and have the type determine the length. Now you have two ``recv``\ s - the fi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
717a7fd5-babc-46db-8707-173377465035
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,188
supabase-export-v2
ef66a8048d0499e3
sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you passed in. If a socket is in the output readable list, you can be as-close-to-certain-as-we-ever-get-in-this-business that a ``recv`` on that socket will return *something*. Same ide...
trusted_official_docs
CPython Docs
sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you passed in. If a socket is in the output readable list, you can be as-close-to-certain-as-we-ever-get-in-this-business that a ``recv`` on that socket will return *something*. Same ide...
sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you passed in. If a socket is in the output readable list, you can be as-close-to-certain-as-we-ever-get-in-this-business that a ``recv`` on that socket will return *something*. Same ide...
python, official-docs, cpython, P0
Local_Trusted_Corpus
76a5b80a-deaa-4375-8c38-02980d06a0e4
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,132
supabase-export-v2
c67d2063476c1127
with blocking and non-blocking sockets. But I'll start by talking about blocking sockets. You'll need to know how they work before dealing with non-blocking sockets. Part of the trouble with understanding these things is that "socket" can mean a number of subtly different things, depending on context. So first, let's m...
trusted_official_docs
CPython Docs
with blocking and non-blocking sockets. But I'll start by talking about blocking sockets. You'll need to know how they work before dealing with non-blocking sockets. Part of the trouble with understanding these things is that "socket" can mean a number of subtly different things, depending on context. So first, let's m...
with blocking and non-blocking sockets. But I'll start by talking about blocking sockets. You'll need to know how they work before dealing with non-blocking sockets. Part of the trouble with understanding these things is that "socket" can mean a number of subtly different things, depending on context. So first, let's m...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7b250fb4-fb28-4125-9ee7-1a0d47669dea
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,154
supabase-export-v2
bafd2ebe2a3df706
for a reply. Without a ``flush`` in there, you may wait forever for the reply, because the request may still be in your output buffer. Now we come to the major stumbling block of sockets - ``send`` and ``recv`` operate on the network buffers. They do not necessarily handle all the bytes you hand them (or expect from th...
trusted_official_docs
CPython Docs
for a reply. Without a ``flush`` in there, you may wait forever for the reply, because the request may still be in your output buffer. Now we come to the major stumbling block of sockets - ``send`` and ``recv`` operate on the network buffers. They do not necessarily handle all the bytes you hand them (or expect from th...
for a reply. Without a ``flush`` in there, you may wait forever for the reply, because the request may still be in your output buffer. Now we come to the major stumbling block of sockets - ``send`` and ``recv`` operate on the network buffers. They do not necessarily handle all the bytes you hand them (or expect from th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7ec3744e-5884-433a-81e1-884a9a8fa67e
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,172
supabase-export-v2
00361cab40508540
and "l" means *long*. Where network order is host order, these do nothing, but where the machine is byte-reversed, these swap the bytes around appropriately. In these days of 64-bit machines, the ASCII representation of binary data is frequently smaller than the binary representation. That's because a surprising amount...
trusted_official_docs
CPython Docs
and "l" means *long*. Where network order is host order, these do nothing, but where the machine is byte-reversed, these swap the bytes around appropriately. In these days of 64-bit machines, the ASCII representation of binary data is frequently smaller than the binary representation. That's because a surprising amount...
and "l" means *long*. Where network order is host order, these do nothing, but where the machine is byte-reversed, these swap the bytes around appropriately. In these days of 64-bit machines, the ASCII representation of binary data is frequently smaller than the binary representation. That's because a surprising amount...
python, official-docs, cpython, P0
Local_Trusted_Corpus
80ecf89a-4da2-40ab-8273-de764e6a4096
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,157
supabase-export-v2
b4d1603a4f4c67bd
reads a reply. That's it. The socket is discarded. This means that a client can detect the end of the reply by receiving 0 bytes. But if you plan to reuse your socket for further transfers, you need to realize that *there is no* :abbr:`EOT (End of Transfer)` *on a socket.* I repeat: if a socket ``send`` or ``recv`` ret...
trusted_official_docs
CPython Docs
reads a reply. That's it. The socket is discarded. This means that a client can detect the end of the reply by receiving 0 bytes. But if you plan to reuse your socket for further transfers, you need to realize that *there is no* :abbr:`EOT (End of Transfer)` *on a socket.* I repeat: if a socket ``send`` or ``recv`` ret...
reads a reply. That's it. The socket is discarded. This means that a client can detect the end of the reply by receiving 0 bytes. But if you plan to reuse your socket for further transfers, you need to realize that *there is no* :abbr:`EOT (End of Transfer)` *on a socket.* I repeat: if a socket ``send`` or ``recv`` ret...
python, official-docs, cpython, P0
Local_Trusted_Corpus
84044692-df4e-45dc-bda5-3faefb59e39f
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,156
supabase-export-v2
aaa48866abb29be9
You will not receive any more data on this connection. Ever. You may be able to send data successfully; I'll talk more about this later. A protocol like HTTP uses a socket for only one transfer. The client sends a request, then reads a reply. That's it. The socket is discarded. This means that a client can detect the e...
trusted_official_docs
CPython Docs
You will not receive any more data on this connection. Ever. You may be able to send data successfully; I'll talk more about this later. A protocol like HTTP uses a socket for only one transfer. The client sends a request, then reads a reply. That's it. The socket is discarded. This means that a client can detect the e...
You will not receive any more data on this connection. Ever. You may be able to send data successfully; I'll talk more about this later. A protocol like HTTP uses a socket for only one transfer. The client sends a request, then reads a reply. That's it. The socket is discarded. This means that a client can detect the e...
python, official-docs, cpython, P0
Local_Trusted_Corpus
881d623e-dce6-4aa8-b784-acb12c4c0823
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,163
supabase-export-v2
a8d15e7f63581981
mysend(self, msg): totalsent = 0 while totalsent < MSGLEN: sent = self.sock.send(msg[totalsent:]) if sent == 0: raise RuntimeError("socket connection broken") totalsent = totalsent + sent def myreceive(self): chunks = [] bytes_recd = 0 while bytes_recd < MSGLEN: chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048)...
trusted_official_docs
CPython Docs
mysend(self, msg): totalsent = 0 while totalsent < MSGLEN: sent = self.sock.send(msg[totalsent:]) if sent == 0: raise RuntimeError("socket connection broken") totalsent = totalsent + sent def myreceive(self): chunks = [] bytes_recd = 0 while bytes_recd < MSGLEN: chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048)...
mysend(self, msg): totalsent = 0 while totalsent < MSGLEN: sent = self.sock.send(msg[totalsent:]) if sent == 0: raise RuntimeError("socket connection broken") totalsent = totalsent + sent def myreceive(self): chunks = [] bytes_recd = 0 while bytes_recd < MSGLEN: chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048)...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9a56dbf2-7a52-4c71-9fe7-e8c62b98be82
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,190
supabase-export-v2
42c77e7fd121641e
someone else, put it in the potential_writers list. If it shows up in the writable list, you have a decent chance that it has connected. Actually, ``select`` can be handy even with blocking sockets. It's one way of determining whether you will block - the socket returns as readable when there's something in the buffers...
trusted_official_docs
CPython Docs
someone else, put it in the potential_writers list. If it shows up in the writable list, you have a decent chance that it has connected. Actually, ``select`` can be handy even with blocking sockets. It's one way of determining whether you will block - the socket returns as readable when there's something in the buffers...
someone else, put it in the potential_writers list. If it shows up in the writable list, you have a decent chance that it has connected. Actually, ``select`` can be handy even with blocking sockets. It's one way of determining whether you will block - the socket returns as readable when there's something in the buffers...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a22df0bf-c841-4e09-80a0-18d893cd70c9
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,167
supabase-export-v2
fc70450f8faf1005
size, you may end up reading the start of a following message. You'll need to put that aside and hold onto it, until it's needed. Prefixing the message with its length (say, as 5 numeric characters) gets more complex, because (believe it or not), you may not get all 5 characters in one ``recv``. In playing around, you'...
trusted_official_docs
CPython Docs
size, you may end up reading the start of a following message. You'll need to put that aside and hold onto it, until it's needed. Prefixing the message with its length (say, as 5 numeric characters) gets more complex, because (believe it or not), you may not get all 5 characters in one ``recv``. In playing around, you'...
size, you may end up reading the start of a following message. You'll need to put that aside and hold onto it, until it's needed. Prefixing the message with its length (say, as 5 numeric characters) gets more complex, because (believe it or not), you may not get all 5 characters in one ``recv``. In playing around, you'...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a4596132-588d-46c6-918c-141313311fbd
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,150
supabase-export-v2
af7501ebc2382860
socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster. .. seealso:: The :mod:`multiprocessing` integrates cross-platform IPC into a higher-level API.
trusted_official_docs
CPython Docs
socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster. .. seealso:: The :mod:`multiprocessing` integrates cross-platform IPC into a higher-level API.
socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster. .. seealso:: The :mod:`multiprocessing` integrates cross-platform IPC into a higher-level API.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a5d99b75-1f34-4a7d-ad71-64688f9d3782
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,166
supabase-export-v2
b34ad9fce18c1470
in some arbitrary chunk size, (4096 or 8192 is frequently a good match for network buffer sizes), and scanning what you've received for a delimiter. One complication to be aware of: if your conversational protocol allows multiple messages to be sent back to back (without some kind of reply), and you pass ``recv`` an ar...
trusted_official_docs
CPython Docs
in some arbitrary chunk size, (4096 or 8192 is frequently a good match for network buffer sizes), and scanning what you've received for a delimiter. One complication to be aware of: if your conversational protocol allows multiple messages to be sent back to back (without some kind of reply), and you pass ``recv`` an ar...
in some arbitrary chunk size, (4096 or 8192 is frequently a good match for network buffer sizes), and scanning what you've received for a delimiter. One complication to be aware of: if your conversational protocol allows multiple messages to be sent back to back (without some kind of reply), and you pass ``recv`` an ar...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a5fa2232-9d0c-43a3-866c-72c07f05ac3a
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,131
supabase-export-v2
22875d580353f393
Sockets ======= I'm only going to talk about INET (i.e. IPv4) sockets, but they account for at least 99% of the sockets in use. And I'll only talk about STREAM (i.e. TCP) sockets - unless you really know what you're doing (in which case this HOWTO isn't for you!), you'll get better behavior and performance from a STREA...
trusted_official_docs
CPython Docs
Sockets ======= I'm only going to talk about INET (i.e. IPv4) sockets, but they account for at least 99% of the sockets in use. And I'll only talk about STREAM (i.e. TCP) sockets - unless you really know what you're doing (in which case this HOWTO isn't for you!), you'll get better behavior and performance from a STREA...
Sockets ======= I'm only going to talk about INET (i.e. IPv4) sockets, but they account for at least 99% of the sockets in use. And I'll only talk about STREAM (i.e. TCP) sockets - unless you really know what you're doing (in which case this HOWTO isn't for you!), you'll get better behavior and performance from a STREA...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7f79fa0-9a4d-45df-839b-104118f06e2b
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,158
supabase-export-v2
77431848cc792a14
how long they are* (much better), *or end by shutting down the connection*. The choice is entirely yours, (but some ways are righter than others). Assuming you don't want to end the connection, the simplest solution is a fixed length message::
trusted_official_docs
CPython Docs
how long they are* (much better), *or end by shutting down the connection*. The choice is entirely yours, (but some ways are righter than others). Assuming you don't want to end the connection, the simplest solution is a fixed length message::
how long they are* (much better), *or end by shutting down the connection*. The choice is entirely yours, (but some ways are righter than others). Assuming you don't want to end the connection, the simplest solution is a fixed length message::
python, official-docs, cpython, P0
Local_Trusted_Corpus
abef7d9d-515d-48e6-89a3-3f8de13c84c4
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,178
supabase-export-v2
44594b3eec091d8f
When Sockets Die ---------------- Probably the worst thing about using blocking sockets is what happens when the other side comes down hard (without doing a ``close``). Your socket is likely to hang. TCP is a reliable protocol, and it will wait a long, long time before giving up on a connection. If you're using threads...
trusted_official_docs
CPython Docs
When Sockets Die ---------------- Probably the worst thing about using blocking sockets is what happens when the other side comes down hard (without doing a ``close``). Your socket is likely to hang. TCP is a reliable protocol, and it will wait a long, long time before giving up on a connection. If you're using threads...
When Sockets Die ---------------- Probably the worst thing about using blocking sockets is what happens when the other side comes down hard (without doing a ``close``). Your socket is likely to hang. TCP is a reliable protocol, and it will wait a long, long time before giving up on a connection. If you're using threads...
python, official-docs, cpython, P0
Local_Trusted_Corpus
abfb9b76-bbbd-42e6-92aa-2626d455bc4c
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,146
supabase-export-v2
649c4b49f344cca3
Now that we have a "server" socket, listening on port 80, we can enter the mainloop of the web server:: while True: # accept connections from outside (clientsocket, address) = serversocket.accept() # now do something with the clientsocket # in this case, we'll pretend this is a threaded server ct = make_client_thr...
trusted_official_docs
CPython Docs
Now that we have a "server" socket, listening on port 80, we can enter the mainloop of the web server:: while True: # accept connections from outside (clientsocket, address) = serversocket.accept() # now do something with the clientsocket # in this case, we'll pretend this is a threaded server ct = make_client_thr...
Now that we have a "server" socket, listening on port 80, we can enter the mainloop of the web server:: while True: # accept connections from outside (clientsocket, address) = serversocket.accept() # now do something with the clientsocket # in this case, we'll pretend this is a threaded server ct = make_client_thr...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b065cd7a-792c-4beb-b503-a800a341fde6
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,147
supabase-export-v2
cde82a772de4f41f
address) = serversocket.accept() # now do something with the clientsocket # in this case, we'll pretend this is a threaded server ct = make_client_thread(clientsocket) ct.start() There's actually 3 general ways in which this loop could work - dispatching a thread to handle ``clientsocket``, create a new process to hand...
trusted_official_docs
CPython Docs
address) = serversocket.accept() # now do something with the clientsocket # in this case, we'll pretend this is a threaded server ct = make_client_thread(clientsocket) ct.start() There's actually 3 general ways in which this loop could work - dispatching a thread to handle ``clientsocket``, create a new process to hand...
address) = serversocket.accept() # now do something with the clientsocket # in this case, we'll pretend this is a threaded server ct = make_client_thread(clientsocket) ct.start() There's actually 3 general ways in which this loop could work - dispatching a thread to handle ``clientsocket``, create a new process to hand...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ba191853-9434-4f56-a326-2fee32b1f7a1
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,168
supabase-export-v2
0a27bea9f308224e
``send`` does not always manage to get rid of everything in one pass. And despite having read this, you will eventually get bit by it! In the interests of space, building your character, (and preserving my competitive position), these enhancements are left as an exercise for the reader. Lets move on to cleaning up.
trusted_official_docs
CPython Docs
``send`` does not always manage to get rid of everything in one pass. And despite having read this, you will eventually get bit by it! In the interests of space, building your character, (and preserving my competitive position), these enhancements are left as an exercise for the reader. Lets move on to cleaning up.
``send`` does not always manage to get rid of everything in one pass. And despite having read this, you will eventually get bit by it! In the interests of space, building your character, (and preserving my competitive position), these enhancements are left as an exercise for the reader. Lets move on to cleaning up.
python, official-docs, cpython, P0
Local_Trusted_Corpus
bd5c2328-0b21-4180-acf8-871cb2f6e6bd
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,149
supabase-export-v2
a09b811f46e9bd41
IPC --- If you need fast IPC between two processes on one machine, you should look into pipes or shared memory. If you do decide to use AF_INET sockets, bind the "server" socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster.
trusted_official_docs
CPython Docs
IPC --- If you need fast IPC between two processes on one machine, you should look into pipes or shared memory. If you do decide to use AF_INET sockets, bind the "server" socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster.
IPC --- If you need fast IPC between two processes on one machine, you should look into pipes or shared memory. If you do decide to use AF_INET sockets, bind the "server" socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster.
python, official-docs, cpython, P0
Local_Trusted_Corpus
be844f0c-7001-4220-883c-e69b647c9b6f
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,155
supabase-export-v2
c3910b9fef0918e0
They then tell you how many bytes they handled. It is *your* responsibility to call them again until your message has been completely dealt with. When a ``recv`` returns 0 bytes, it means the other side has closed (or is in the process of closing) the connection. You will not receive any more data on this connection. E...
trusted_official_docs
CPython Docs
They then tell you how many bytes they handled. It is *your* responsibility to call them again until your message has been completely dealt with. When a ``recv`` returns 0 bytes, it means the other side has closed (or is in the process of closing) the connection. You will not receive any more data on this connection. E...
They then tell you how many bytes they handled. It is *your* responsibility to call them again until your message has been completely dealt with. When a ``recv`` returns 0 bytes, it means the other side has closed (or is in the process of closing) the connection. You will not receive any more data on this connection. E...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c30557ea-ab2e-47b6-aae0-bb5b8e397d38
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,139
supabase-export-v2
1bb7823fec6f4588
an INET, STREAMing socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # now connect to the web server on port 80 - the normal http port s.connect(("www.python.org", 80)) When the ``connect`` completes, the socket ``s`` can be used to send in a request for the text of the page. The same socket will read the re...
trusted_official_docs
CPython Docs
an INET, STREAMing socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # now connect to the web server on port 80 - the normal http port s.connect(("www.python.org", 80)) When the ``connect`` completes, the socket ``s`` can be used to send in a request for the text of the page. The same socket will read the re...
an INET, STREAMing socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # now connect to the web server on port 80 - the normal http port s.connect(("www.python.org", 80)) When the ``connect`` completes, the socket ``s`` can be used to send in a request for the text of the page. The same socket will read the re...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cac7694c-448a-4c3c-a6ec-672fbc88b825
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,184
supabase-export-v2
c2b60e554e7f9698
Use ``select``. In C, coding ``select`` is fairly complex. In Python, it's a piece of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C::
trusted_official_docs
CPython Docs
Use ``select``. In C, coding ``select`` is fairly complex. In Python, it's a piece of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C::
Use ``select``. In C, coding ``select`` is fairly complex. In Python, it's a piece of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C::
python, official-docs, cpython, P0
Local_Trusted_Corpus
ccb13249-1c09-49a5-a2ff-bd1c3c231d31
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,185
supabase-export-v2
53807a363beaf12a
of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C:: ready_to_read, ready_to_write, in_error = \ select.select( potential_readers, potential_writers, potential_errs, timeout)
trusted_official_docs
CPython Docs
of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C:: ready_to_read, ready_to_write, in_error = \ select.select( potential_readers, potential_writers, potential_errs, timeout)
of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C:: ready_to_read, ready_to_write, in_error = \ select.select( potential_readers, potential_writers, potential_errs, timeout)
python, official-docs, cpython, P0
Local_Trusted_Corpus
ccefb321-afc9-4764-a08b-900e00176f3f
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,186
supabase-export-v2
5cc955dda02af628
ready_to_read, ready_to_write, in_error = \ select.select( potential_readers, potential_writers, potential_errs, timeout) You pass ``select`` three lists: the first contains all sockets that you might want to try reading; the second all the sockets you might want to try writing to, and the last (normally left empty) th...
trusted_official_docs
CPython Docs
ready_to_read, ready_to_write, in_error = \ select.select( potential_readers, potential_writers, potential_errs, timeout) You pass ``select`` three lists: the first contains all sockets that you might want to try reading; the second all the sockets you might want to try writing to, and the last (normally left empty) th...
ready_to_read, ready_to_write, in_error = \ select.select( potential_readers, potential_writers, potential_errs, timeout) You pass ``select`` three lists: the first contains all sockets that you might want to try reading; the second all the sockets you might want to try writing to, and the last (normally left empty) th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d0d0ffae-7414-4cf5-accc-3d3105d8da1e
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,175
supabase-export-v2
25f0a06dd28f5215
use this piece of etiquette that normally a ``close`` is the same as ``shutdown(); close()``. So in most situations, an explicit ``shutdown`` is not needed. One way to use ``shutdown`` effectively is in an HTTP-like exchange. The client sends a request and then does a ``shutdown(1)``. This tells the server "This client...
trusted_official_docs
CPython Docs
use this piece of etiquette that normally a ``close`` is the same as ``shutdown(); close()``. So in most situations, an explicit ``shutdown`` is not needed. One way to use ``shutdown`` effectively is in an HTTP-like exchange. The client sends a request and then does a ``shutdown(1)``. This tells the server "This client...
use this piece of etiquette that normally a ``close`` is the same as ``shutdown(); close()``. So in most situations, an explicit ``shutdown`` is not needed. One way to use ``shutdown`` effectively is in an HTTP-like exchange. The client sends a request and then does a ``shutdown(1)``. This tells the server "This client...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d6686c25-65dd-4418-b9ae-1e04a2c5db1a
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,152
supabase-export-v2
030a2702a9eda38e
Using a Socket ============== The first thing to note, is that the web browser's "client" socket and the web server's "client" socket are identical beasts. That is, this is a "peer to peer" conversation. Or to put it another way, *as the designer, you will have to decide what the rules of etiquette are for a conversati...
trusted_official_docs
CPython Docs
Using a Socket ============== The first thing to note, is that the web browser's "client" socket and the web server's "client" socket are identical beasts. That is, this is a "peer to peer" conversation. Or to put it another way, *as the designer, you will have to decide what the rules of etiquette are for a conversati...
Using a Socket ============== The first thing to note, is that the web browser's "client" socket and the web server's "client" socket are identical beasts. That is, this is a "peer to peer" conversation. Or to put it another way, *as the designer, you will have to decide what the rules of etiquette are for a conversati...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e1657202-901e-4502-bb21-eed55b453de5
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,181
supabase-export-v2
dddb60b44ed860b0
You'll still use the same calls, in much the same ways. It's just that, if you do it right, your app will be almost inside-out. In Python, you use ``socket.setblocking(False)`` to make it non-blocking. In C, it's more complex, (for one thing, you'll need to choose between the BSD flavor ``O_NONBLOCK`` and the almost in...
trusted_official_docs
CPython Docs
You'll still use the same calls, in much the same ways. It's just that, if you do it right, your app will be almost inside-out. In Python, you use ``socket.setblocking(False)`` to make it non-blocking. In C, it's more complex, (for one thing, you'll need to choose between the BSD flavor ``O_NONBLOCK`` and the almost in...
You'll still use the same calls, in much the same ways. It's just that, if you do it right, your app will be almost inside-out. In Python, you use ``socket.setblocking(False)`` to make it non-blocking. In C, it's more complex, (for one thing, you'll need to choose between the BSD flavor ``O_NONBLOCK`` and the almost in...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e75414f1-feb9-4a1b-9383-e93d1907a554
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,174
supabase-export-v2
04b8d526327c836f
Disconnecting ============= Strictly speaking, you're supposed to use ``shutdown`` on a socket before you ``close`` it. The ``shutdown`` is an advisory to the socket at the other end. Depending on the argument you pass it, it can mean "I'm not going to send anymore, but I'll still listen", or "I'm not listening, good r...
trusted_official_docs
CPython Docs
Disconnecting ============= Strictly speaking, you're supposed to use ``shutdown`` on a socket before you ``close`` it. The ``shutdown`` is an advisory to the socket at the other end. Depending on the argument you pass it, it can mean "I'm not going to send anymore, but I'll still listen", or "I'm not listening, good r...
Disconnecting ============= Strictly speaking, you're supposed to use ``shutdown`` on a socket before you ``close`` it. The ``shutdown`` is an advisory to the socket at the other end. Depending on the argument you pass it, it can mean "I'm not going to send anymore, but I'll still listen", or "I'm not listening, good r...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e99d0688-19c0-4c8d-9dc2-a56308afbb99
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,182
supabase-export-v2
73deff9b606e358e
the exact same idea. You do this after creating the socket, but before using it. (Actually, if you're nuts, you can switch back and forth.) The major mechanical difference is that ``send``, ``recv``, ``connect`` and ``accept`` can return without having done anything. You have (of course) a number of choices. You can ch...
trusted_official_docs
CPython Docs
the exact same idea. You do this after creating the socket, but before using it. (Actually, if you're nuts, you can switch back and forth.) The major mechanical difference is that ``send``, ``recv``, ``connect`` and ``accept`` can return without having done anything. You have (of course) a number of choices. You can ch...
the exact same idea. You do this after creating the socket, but before using it. (Actually, if you're nuts, you can switch back and forth.) The major mechanical difference is that ``send``, ``recv``, ``connect`` and ``accept`` can return without having done anything. You have (of course) a number of choices. You can ch...
python, official-docs, cpython, P0
Local_Trusted_Corpus
eb5454a5-19fd-44f5-b942-dcda4dba0af6
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,129
supabase-export-v2
32d256fc471d37df
.. topic:: Abstract Sockets are used nearly everywhere, but are one of the most severely misunderstood technologies around. This is a 10,000 foot overview of sockets. It's not really a tutorial - you'll still have work to do in getting things operational. It doesn't cover the fine points (and there are a lot of them)...
trusted_official_docs
CPython Docs
.. topic:: Abstract Sockets are used nearly everywhere, but are one of the most severely misunderstood technologies around. This is a 10,000 foot overview of sockets. It's not really a tutorial - you'll still have work to do in getting things operational. It doesn't cover the fine points (and there are a lot of them)...
.. topic:: Abstract Sockets are used nearly everywhere, but are one of the most severely misunderstood technologies around. This is a 10,000 foot overview of sockets. It's not really a tutorial - you'll still have work to do in getting things operational. It doesn't cover the fine points (and there are a lot of them)...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f3b89db0-f39d-4489-a504-f80ca67aece5
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,141
supabase-export-v2
e17ac7940ad15deb
What happens in the web server is a bit more complex. First, the web server creates a "server socket":: # create an INET, STREAMing socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # bind the socket to a public host, and a well-known port serversocket.bind((socket.gethostname(), 80)) # become...
trusted_official_docs
CPython Docs
What happens in the web server is a bit more complex. First, the web server creates a "server socket":: # create an INET, STREAMing socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # bind the socket to a public host, and a well-known port serversocket.bind((socket.gethostname(), 80)) # become...
What happens in the web server is a bit more complex. First, the web server creates a "server socket":: # create an INET, STREAMing socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # bind the socket to a public host, and a well-known port serversocket.bind((socket.gethostname(), 80)) # become...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fc047b1c-8a5c-4d0d-a2cb-21042dcce5bb
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,164
supabase-export-v2
237e83bcb94561a6
bytes_recd < MSGLEN: chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048)) if chunk == b'': raise RuntimeError("socket connection broken") chunks.append(chunk) bytes_recd = bytes_recd + len(chunk) return b''.join(chunks) The sending code here is usable for almost any messaging scheme - in Python you send strings, and ...
trusted_official_docs
CPython Docs
bytes_recd < MSGLEN: chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048)) if chunk == b'': raise RuntimeError("socket connection broken") chunks.append(chunk) bytes_recd = bytes_recd + len(chunk) return b''.join(chunks) The sending code here is usable for almost any messaging scheme - in Python you send strings, and ...
bytes_recd < MSGLEN: chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048)) if chunk == b'': raise RuntimeError("socket connection broken") chunks.append(chunk) bytes_recd = bytes_recd + len(chunk) return b''.join(chunks) The sending code here is usable for almost any messaging scheme - in Python you send strings, and ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fdf3c1dd-4cb6-40f9-b11e-46992fd3fc3f
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,145
supabase-export-v2
82b8ba5b7add4d65
many as 5 connect requests (the normal max) before refusing outside connections. If the rest of the code is written properly, that should be plenty. Now that we have a "server" socket, listening on port 80, we can enter the mainloop of the web server::
trusted_official_docs
CPython Docs
many as 5 connect requests (the normal max) before refusing outside connections. If the rest of the code is written properly, that should be plenty. Now that we have a "server" socket, listening on port 80, we can enter the mainloop of the web server::
many as 5 connect requests (the normal max) before refusing outside connections. If the rest of the code is written properly, that should be plenty. Now that we have a "server" socket, listening on port 80, we can enter the mainloop of the web server::
python, official-docs, cpython, P0
Local_Trusted_Corpus
fedbc024-fde2-49cf-a97a-21be9da64634
CPython Docs
file://datasets/cpython/Doc/howto/sockets.rst
unknown
d7d867d4-d36e-401a-a7c7-6390415bd8ce
59,187
supabase-export-v2
e561c94e66830802
is generally a sensible thing to do - give it a nice long timeout (say a minute) unless you have good reason to do otherwise. In return, you will get three lists. They contain the sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you pa...
trusted_official_docs
CPython Docs
is generally a sensible thing to do - give it a nice long timeout (say a minute) unless you have good reason to do otherwise. In return, you will get three lists. They contain the sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you pa...
is generally a sensible thing to do - give it a nice long timeout (say a minute) unless you have good reason to do otherwise. In return, you will get three lists. They contain the sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you pa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
04bb7ce0-df33-4a83-b57a-2e02117d3f9a
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,330
supabase-export-v2
be2f58dc10f96db5
The first list contains UTF-8-encoded filenames, and the second list contains the Unicode versions. Note that on most occasions, you should can just stick with using Unicode with these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems n...
trusted_official_docs
CPython Docs
The first list contains UTF-8-encoded filenames, and the second list contains the Unicode versions. Note that on most occasions, you should can just stick with using Unicode with these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems n...
The first list contains UTF-8-encoded filenames, and the second list contains the Unicode versions. Note that on most occasions, you should can just stick with using Unicode with these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems n...
python, official-docs, cpython, P0
Local_Trusted_Corpus
07b95f50-437b-4da1-afeb-befd87296bf1
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,230
supabase-export-v2
f20846e9b755c075
The String Type --------------- Since Python 3.0, the language's :class:`str` type contains Unicode characters, meaning any string created using ``"unicode rocks!"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode.
trusted_official_docs
CPython Docs
The String Type --------------- Since Python 3.0, the language's :class:`str` type contains Unicode characters, meaning any string created using ``"unicode rocks!"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode.
The String Type --------------- Since Python 3.0, the language's :class:`str` type contains Unicode characters, meaning any string created using ``"unicode rocks!"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1301a122-6162-4de2-bb42-1ad6069eed5b
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,241
supabase-export-v2
e9a6734efcf38bd0
Library Reference at :ref:`standard-encodings` for a list. Some encodings have multiple names; for example, ``'latin-1'``, ``'iso_8859_1'`` and ``'8859``' are all synonyms for the same encoding. One-character Unicode strings can also be created with the :func:`chr` built-in function, which takes integers and returns a ...
trusted_official_docs
CPython Docs
Library Reference at :ref:`standard-encodings` for a list. Some encodings have multiple names; for example, ``'latin-1'``, ``'iso_8859_1'`` and ``'8859``' are all synonyms for the same encoding. One-character Unicode strings can also be created with the :func:`chr` built-in function, which takes integers and returns a ...
Library Reference at :ref:`standard-encodings` for a list. Some encodings have multiple names; for example, ``'latin-1'``, ``'iso_8859_1'`` and ``'8859``' are all synonyms for the same encoding. One-character Unicode strings can also be created with the :func:`chr` built-in function, which takes integers and returns a ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
13328176-8f0e-4baa-b4a6-d76bb506970f
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,296
supabase-export-v2
22e724b4b037c75c
s = "Over \u0e55\u0e57 57 flavours" m = p.search(s) print(repr(m.group())) When executed, ``\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\d+`` will match the substring "57" instead.
trusted_official_docs
CPython Docs
s = "Over \u0e55\u0e57 57 flavours" m = p.search(s) print(repr(m.group())) When executed, ``\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\d+`` will match the substring "57" instead.
s = "Over \u0e55\u0e57 57 flavours" m = p.search(s) print(repr(m.group())) When executed, ``\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\d+`` will match the substring "57" instead.
python, official-docs, cpython, P0
Local_Trusted_Corpus
1339d7b6-f596-4d8f-a074-e5e1651acbfb
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,197
supabase-export-v2
d2d891b8d452b7e6
Definitions ----------- Today's programs need to be able to handle a wide variety of characters. Applications are often internationalized to display messages and output in a variety of user-selectable languages; the same program might need to output an error message in English, French, Japanese, Hebrew, or Russian. Web...
trusted_official_docs
CPython Docs
Definitions ----------- Today's programs need to be able to handle a wide variety of characters. Applications are often internationalized to display messages and output in a variety of user-selectable languages; the same program might need to output an error message in English, French, Japanese, Hebrew, or Russian. Web...
Definitions ----------- Today's programs need to be able to handle a wide variety of characters. Applications are often internationalized to display messages and output in a variety of user-selectable languages; the same program might need to output an error message in English, French, Japanese, Hebrew, or Russian. Web...
python, official-docs, cpython, P0
Local_Trusted_Corpus
15099d61-a4b0-4cc6-9693-16c9a046593f
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,301
supabase-export-v2
d33c81a8e7661e10
Some good alternative discussions of Python's Unicode support are: * `Processing Text Files in Python 3 <https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan. * `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batc...
trusted_official_docs
CPython Docs
Some good alternative discussions of Python's Unicode support are: * `Processing Text Files in Python 3 <https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan. * `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batc...
Some good alternative discussions of Python's Unicode support are: * `Processing Text Files in Python 3 <https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan. * `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batc...
python, official-docs, cpython, P0
Local_Trusted_Corpus
175ea6f0-3eb3-46e8-9842-39c6e0933994
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,225
supabase-export-v2
e33fa22a8c4d182f
To help understand the standard, Jukka Korpela has written `an introductory guide <https://jkorpela.fi/unicode/guide.html>`_ to reading the Unicode character tables. Another `good introductory article <https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-kno...
trusted_official_docs
CPython Docs
To help understand the standard, Jukka Korpela has written `an introductory guide <https://jkorpela.fi/unicode/guide.html>`_ to reading the Unicode character tables. Another `good introductory article <https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-kno...
To help understand the standard, Jukka Korpela has written `an introductory guide <https://jkorpela.fi/unicode/guide.html>`_ to reading the Unicode character tables. Another `good introductory article <https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-kno...
python, official-docs, cpython, P0
Local_Trusted_Corpus
18c3a918-d71d-4ad9-a3da-b1b20989cd0b
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,236
supabase-export-v2
edadae0acc47ef89
can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta glyph instead of a \u escape.) :: >>> "\N{GREEK CAPITAL LETTER DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '...
trusted_official_docs
CPython Docs
can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta glyph instead of a \u escape.) :: >>> "\N{GREEK CAPITAL LETTER DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '...
can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta glyph instead of a \u escape.) :: >>> "\N{GREEK CAPITAL LETTER DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '...
python, official-docs, cpython, P0
Local_Trusted_Corpus
18d45cec-a1f6-4750-b792-2bcdd5ac9e90
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,235
supabase-export-v2
f461adf88a8d5bc0
répertoire = "/tmp/records.log" with open(répertoire, "w") as f: f.write("test\n") If you can't enter a particular character in your editor or want to keep the source code ASCII-only for some reason, you can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta gl...
trusted_official_docs
CPython Docs
répertoire = "/tmp/records.log" with open(répertoire, "w") as f: f.write("test\n") If you can't enter a particular character in your editor or want to keep the source code ASCII-only for some reason, you can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta gl...
répertoire = "/tmp/records.log" with open(répertoire, "w") as f: f.write("test\n") If you can't enter a particular character in your editor or want to keep the source code ASCII-only for some reason, you can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta gl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1b3da928-d3ef-484f-b372-901bde33de4e
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,292
supabase-export-v2
819c728500470ada
Unicode Regular Expressions --------------------------- The regular expressions supported by the :mod:`re` module can be provided either as bytes or strings. Some of the special character sequences such as ``\d`` and ``\w`` have different meanings depending on whether the pattern is supplied as bytes or a string. For e...
trusted_official_docs
CPython Docs
Unicode Regular Expressions --------------------------- The regular expressions supported by the :mod:`re` module can be provided either as bytes or strings. Some of the special character sequences such as ``\d`` and ``\w`` have different meanings depending on whether the pattern is supplied as bytes or a string. For e...
Unicode Regular Expressions --------------------------- The regular expressions supported by the :mod:`re` module can be provided either as bytes or strings. Some of the special character sequences such as ``\d`` and ``\w`` have different meanings depending on whether the pattern is supplied as bytes or a string. For e...
python, official-docs, cpython, P0
Local_Trusted_Corpus
1c7dbaf4-ff17-4f8b-8b78-24ac44b4a288
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,268
supabase-export-v2
a9020831980ade7c
.. code-block:: none 0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE 1 0bf2 No TAMIL NUMBER ONE THOUSAND 2 0f84 Mn TIBETAN MARK HALANTA 3 1770 Lo TAGBANWA LETTER SA 4 33af So SQUARE RAD OVER S SQUARED 1000.0
trusted_official_docs
CPython Docs
.. code-block:: none 0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE 1 0bf2 No TAMIL NUMBER ONE THOUSAND 2 0f84 Mn TIBETAN MARK HALANTA 3 1770 Lo TAGBANWA LETTER SA 4 33af So SQUARE RAD OVER S SQUARED 1000.0
.. code-block:: none 0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE 1 0bf2 No TAMIL NUMBER ONE THOUSAND 2 0f84 Mn TIBETAN MARK HALANTA 3 1770 Lo TAGBANWA LETTER SA 4 33af So SQUARE RAD OVER S SQUARED 1000.0
python, official-docs, cpython, P0
Local_Trusted_Corpus
1dc74a58-0ee6-4d4c-ad17-6be317e9a714
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,240
supabase-export-v2
8e8b218296c1a347
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte >>> b'\x80abc'.decode("utf-8", "replace") '\ufffdabc' >>> b'\x80abc'.decode("utf-8", "backslashreplace") '\\x80abc' >>> b'\x80abc'.decode("utf-8", "ignore") 'abc' Encodings are specified as strings containing the encoding's name....
trusted_official_docs
CPython Docs
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte >>> b'\x80abc'.decode("utf-8", "replace") '\ufffdabc' >>> b'\x80abc'.decode("utf-8", "backslashreplace") '\\x80abc' >>> b'\x80abc'.decode("utf-8", "ignore") 'abc' Encodings are specified as strings containing the encoding's name....
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte >>> b'\x80abc'.decode("utf-8", "replace") '\ufffdabc' >>> b'\x80abc'.decode("utf-8", "backslashreplace") '\\x80abc' >>> b'\x80abc'.decode("utf-8", "ignore") 'abc' Encodings are specified as strings containing the encoding's name....
python, official-docs, cpython, P0
Local_Trusted_Corpus
1ed910c1-03ae-4c48-a852-d2fe29c2a684
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,211
supabase-export-v2
14b5d7e7c09ec8e6
00 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 This representation is straightforward but using it presents a number of problems.
trusted_official_docs
CPython Docs
00 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 This representation is straightforward but using it presents a number of problems.
00 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 This representation is straightforward but using it presents a number of problems.
python, official-docs, cpython, P0
Local_Trusted_Corpus
202f9b6d-3203-4321-ac73-4fa57247c0e7
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,337
supabase-export-v2
1e9fbf60b1e65a66
if the input data also specifies the encoding, since the attacker can then choose a clever way to hide malicious text in the encoded bytestream. Converting Between File Encodings '''''''''''''''''''''''''''''''''
trusted_official_docs
CPython Docs
if the input data also specifies the encoding, since the attacker can then choose a clever way to hide malicious text in the encoded bytestream. Converting Between File Encodings '''''''''''''''''''''''''''''''''
if the input data also specifies the encoding, since the attacker can then choose a clever way to hide malicious text in the encoded bytestream. Converting Between File Encodings '''''''''''''''''''''''''''''''''
python, official-docs, cpython, P0
Local_Trusted_Corpus
2293c17d-7405-4b21-b36a-9e200636c842
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,344
supabase-export-v2
4d807b958a0ecbdc
know the encoding is ASCII-compatible and only want to examine or modify the ASCII parts, you can open the file with the ``surrogateescape`` error handler:: with open(fname, 'r', encoding="ascii", errors="surrogateescape") as f: data = f.read()
trusted_official_docs
CPython Docs
know the encoding is ASCII-compatible and only want to examine or modify the ASCII parts, you can open the file with the ``surrogateescape`` error handler:: with open(fname, 'r', encoding="ascii", errors="surrogateescape") as f: data = f.read()
know the encoding is ASCII-compatible and only want to examine or modify the ASCII parts, you can open the file with the ``surrogateescape`` error handler:: with open(fname, 'r', encoding="ascii", errors="surrogateescape") as f: data = f.read()
python, official-docs, cpython, P0
Local_Trusted_Corpus
257acd9a-6137-49e5-a2f0-023e63be5f08
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,247
supabase-export-v2
9cee4230b8b90113
The following example shows the different results:: >>> u = chr(40960) + 'abcd' + chr(1972) >>> u.encode('utf-8') b'\xea\x80\x80abcd\xde\xb4' >>> u.encode('ascii') #doctest: +NORMALIZE_WHITESPACE Traceback (most recent call last): ... UnicodeEncodeError: 'ascii' codec can't encode character '\ua000' in position 0...
trusted_official_docs
CPython Docs
The following example shows the different results:: >>> u = chr(40960) + 'abcd' + chr(1972) >>> u.encode('utf-8') b'\xea\x80\x80abcd\xde\xb4' >>> u.encode('ascii') #doctest: +NORMALIZE_WHITESPACE Traceback (most recent call last): ... UnicodeEncodeError: 'ascii' codec can't encode character '\ua000' in position 0...
The following example shows the different results:: >>> u = chr(40960) + 'abcd' + chr(1972) >>> u.encode('utf-8') b'\xea\x80\x80abcd\xde\xb4' >>> u.encode('ascii') #doctest: +NORMALIZE_WHITESPACE Traceback (most recent call last): ... UnicodeEncodeError: 'ascii' codec can't encode character '\ua000' in position 0...
python, official-docs, cpython, P0
Local_Trusted_Corpus
28ff7070-1f72-4039-8f44-7add9b084729
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,248
supabase-export-v2
eaa72cb6fceb28b7
not in range(128) >>> u.encode('ascii', 'ignore') b'abcd' >>> u.encode('ascii', 'replace') b'?abcd?' >>> u.encode('ascii', 'xmlcharrefreplace') b'&#40960;abcd&#1972;' >>> u.encode('ascii', 'backslashreplace') b'\\ua000abcd\\u07b4' >>> u.encode('ascii', 'namereplace') b'\\N{YI SYLLABLE IT}abcd\\u07b4' The low-level rout...
trusted_official_docs
CPython Docs
not in range(128) >>> u.encode('ascii', 'ignore') b'abcd' >>> u.encode('ascii', 'replace') b'?abcd?' >>> u.encode('ascii', 'xmlcharrefreplace') b'&#40960;abcd&#1972;' >>> u.encode('ascii', 'backslashreplace') b'\\ua000abcd\\u07b4' >>> u.encode('ascii', 'namereplace') b'\\N{YI SYLLABLE IT}abcd\\u07b4' The low-level rout...
not in range(128) >>> u.encode('ascii', 'ignore') b'abcd' >>> u.encode('ascii', 'replace') b'?abcd?' >>> u.encode('ascii', 'xmlcharrefreplace') b'&#40960;abcd&#1972;' >>> u.encode('ascii', 'backslashreplace') b'\\ua000abcd\\u07b4' >>> u.encode('ascii', 'namereplace') b'\\N{YI SYLLABLE IT}abcd\\u07b4' The low-level rout...
python, official-docs, cpython, P0
Local_Trusted_Corpus
299b311a-557a-4cad-aae4-3bdd78b19e82
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,302
supabase-export-v2
91ed366c1fd79bfa
* `Processing Text Files in Python 3 <https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan. * `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batchelder. The :class:`str` type is described in the Python library re...
trusted_official_docs
CPython Docs
* `Processing Text Files in Python 3 <https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan. * `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batchelder. The :class:`str` type is described in the Python library re...
* `Processing Text Files in Python 3 <https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan. * `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batchelder. The :class:`str` type is described in the Python library re...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2d622cbf-bd8d-43f9-bc0b-25d79541154a
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,269
supabase-export-v2
9f6bbc48a60126aa
TAMIL NUMBER ONE THOUSAND 2 0f84 Mn TIBETAN MARK HALANTA 3 1770 Lo TAGBANWA LETTER SA 4 33af So SQUARE RAD OVER S SQUARED 1000.0 The category codes are abbreviations describing the nature of the character. These are grouped into categories such as "Letter", "Number", "Punctuation", or "Symbol", which in turn are broken...
trusted_official_docs
CPython Docs
TAMIL NUMBER ONE THOUSAND 2 0f84 Mn TIBETAN MARK HALANTA 3 1770 Lo TAGBANWA LETTER SA 4 33af So SQUARE RAD OVER S SQUARED 1000.0 The category codes are abbreviations describing the nature of the character. These are grouped into categories such as "Letter", "Number", "Punctuation", or "Symbol", which in turn are broken...
TAMIL NUMBER ONE THOUSAND 2 0f84 Mn TIBETAN MARK HALANTA 3 1770 Lo TAGBANWA LETTER SA 4 33af So SQUARE RAD OVER S SQUARED 1000.0 The category codes are abbreviations describing the nature of the character. These are grouped into categories such as "Letter", "Number", "Punctuation", or "Symbol", which in turn are broken...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2f81736f-7877-48cb-b169-ee411e86a677
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,261
supabase-export-v2
d42af448a623f27e
Unicode Properties ------------------ The Unicode specification includes a database of information about code points. For each defined code point, the information includes the character's name, its category, the numeric value if applicable (for characters representing numeric concepts such as the Roman numerals, fracti...
trusted_official_docs
CPython Docs
Unicode Properties ------------------ The Unicode specification includes a database of information about code points. For each defined code point, the information includes the character's name, its category, the numeric value if applicable (for characters representing numeric concepts such as the Roman numerals, fracti...
Unicode Properties ------------------ The Unicode specification includes a database of information about code points. For each defined code point, the information includes the character's name, its category, the numeric value if applicable (for characters representing numeric concepts such as the Roman numerals, fracti...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3157dcd6-7a71-4c56-a7aa-1e60d6368f51
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,316
supabase-export-v2
fb724263d1e2d135
with open('test', encoding='utf-8', mode='w+') as f: f.write('\u4500 blah blah blah\n') f.seek(0) print(repr(f.readline()[:1])) The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is often written as the first character of a file in order to assist with autodetection of the file's byte ordering. So...
trusted_official_docs
CPython Docs
with open('test', encoding='utf-8', mode='w+') as f: f.write('\u4500 blah blah blah\n') f.seek(0) print(repr(f.readline()[:1])) The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is often written as the first character of a file in order to assist with autodetection of the file's byte ordering. So...
with open('test', encoding='utf-8', mode='w+') as f: f.write('\u4500 blah blah blah\n') f.seek(0) print(repr(f.readline()[:1])) The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is often written as the first character of a file in order to assist with autodetection of the file's byte ordering. So...
python, official-docs, cpython, P0
Local_Trusted_Corpus
319c2812-40c6-4784-bba5-9acff6d34d23
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,223
supabase-export-v2
ef3287bf53e83746
the Unicode specification. Be prepared for some difficult reading. `A chronology <https://www.unicode.org/history/>`_ of the origin and development of Unicode is also available on the site. On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 <https://www.youtube.com/watch...
trusted_official_docs
CPython Docs
the Unicode specification. Be prepared for some difficult reading. `A chronology <https://www.unicode.org/history/>`_ of the origin and development of Unicode is also available on the site. On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 <https://www.youtube.com/watch...
the Unicode specification. Be prepared for some difficult reading. `A chronology <https://www.unicode.org/history/>`_ of the origin and development of Unicode is also available on the site. On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 <https://www.youtube.com/watch...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3503d4ce-daa1-4d6f-abfd-4d5a26077b08
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,354
supabase-export-v2
5ac50f23ab15eed6
draft of this document was written by Andrew Kuchling. It has since been revised further by Alexander Belopolsky, Georg Brandl, Andrew Kuchling, and Ezio Melotti. Thanks to the following people who have noted errors or offered suggestions on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius Gedminas, Ken...
trusted_official_docs
CPython Docs
draft of this document was written by Andrew Kuchling. It has since been revised further by Alexander Belopolsky, Georg Brandl, Andrew Kuchling, and Ezio Melotti. Thanks to the following people who have noted errors or offered suggestions on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius Gedminas, Ken...
draft of this document was written by Andrew Kuchling. It has since been revised further by Alexander Belopolsky, Georg Brandl, Andrew Kuchling, and Ezio Melotti. Thanks to the following people who have noted errors or offered suggestions on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius Gedminas, Ken...
python, official-docs, cpython, P0
Local_Trusted_Corpus
366e07ac-646a-4cea-8f16-0c17d3510442
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,214
supabase-export-v2
b0b829e6ddb57dea
gigabytes of RAM, and strings aren't usually that large), but expanding our usage of disk and network bandwidth by a factor of 4 is intolerable. 3. It's not compatible with existing C functions such as ``strlen()``, so a new family of wide string functions would need to be used.
trusted_official_docs
CPython Docs
gigabytes of RAM, and strings aren't usually that large), but expanding our usage of disk and network bandwidth by a factor of 4 is intolerable. 3. It's not compatible with existing C functions such as ``strlen()``, so a new family of wide string functions would need to be used.
gigabytes of RAM, and strings aren't usually that large), but expanding our usage of disk and network bandwidth by a factor of 4 is intolerable. 3. It's not compatible with existing C functions such as ``strlen()``, so a new family of wide string functions would need to be used.
python, official-docs, cpython, P0
Local_Trusted_Corpus
36be50eb-aa4a-44c2-b3bb-5659512b295e
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,290
supabase-export-v2
9bf2d985fb9b8c18
print(compare_caseless(single_char, multiple_chars)) This will print ``True``. (Why is :func:`!NFD` invoked twice? Because there are a few characters that make :meth:`~str.casefold` return a non-normalized string, so the result needs to be normalized again. See section 3.13 of the Unicode Standard for a discussion and ...
trusted_official_docs
CPython Docs
print(compare_caseless(single_char, multiple_chars)) This will print ``True``. (Why is :func:`!NFD` invoked twice? Because there are a few characters that make :meth:`~str.casefold` return a non-normalized string, so the result needs to be normalized again. See section 3.13 of the Unicode Standard for a discussion and ...
print(compare_caseless(single_char, multiple_chars)) This will print ``True``. (Why is :func:`!NFD` invoked twice? Because there are a few characters that make :meth:`~str.casefold` return a non-normalized string, so the result needs to be normalized again. See section 3.13 of the Unicode Standard for a discussion and ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
378a20ff-d20f-467d-b2eb-c3426c7b229b
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,254
supabase-export-v2
c28be6285a741aed
could then edit Python source code with your favorite editor which would display the accented characters naturally, and have the right characters used at runtime. Python supports writing source code in UTF-8 by default, but you can use almost any encoding if you declare the encoding being used. This is done by includin...
trusted_official_docs
CPython Docs
could then edit Python source code with your favorite editor which would display the accented characters naturally, and have the right characters used at runtime. Python supports writing source code in UTF-8 by default, but you can use almost any encoding if you declare the encoding being used. This is done by includin...
could then edit Python source code with your favorite editor which would display the accented characters naturally, and have the right characters used at runtime. Python supports writing source code in UTF-8 by default, but you can use almost any encoding if you declare the encoding being used. This is done by includin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
3bbce0df-119c-4278-9fbc-808a76d898c5
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,222
supabase-export-v2
21b30f3c0d41ad33
References ---------- The `Unicode Consortium site <https://www.unicode.org>`_ has character charts, a glossary, and PDF versions of the Unicode specification. Be prepared for some difficult reading. `A chronology <https://www.unicode.org/history/>`_ of the origin and development of Unicode is also available on the sit...
trusted_official_docs
CPython Docs
References ---------- The `Unicode Consortium site <https://www.unicode.org>`_ has character charts, a glossary, and PDF versions of the Unicode specification. Be prepared for some difficult reading. `A chronology <https://www.unicode.org/history/>`_ of the origin and development of Unicode is also available on the sit...
References ---------- The `Unicode Consortium site <https://www.unicode.org>`_ has character charts, a glossary, and PDF versions of the Unicode specification. Be prepared for some difficult reading. `A chronology <https://www.unicode.org/history/>`_ of the origin and development of Unicode is also available on the sit...
python, official-docs, cpython, P0
Local_Trusted_Corpus
419d7b38-a6ee-493f-b4df-b55d78f965ec
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,336
supabase-export-v2
395b66376d43931c
the two different kinds of strings. There is no automatic encoding or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be raised. When using data coming from a web browser or some other untrusted source, a common technique is to check for illegal characters in a string before using the string in a gene...
trusted_official_docs
CPython Docs
the two different kinds of strings. There is no automatic encoding or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be raised. When using data coming from a web browser or some other untrusted source, a common technique is to check for illegal characters in a string before using the string in a gene...
the two different kinds of strings. There is no automatic encoding or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be raised. When using data coming from a web browser or some other untrusted source, a common technique is to check for illegal characters in a string before using the string in a gene...
python, official-docs, cpython, P0
Local_Trusted_Corpus
42a26ace-4984-4071-990c-b255e68c292b
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,283
supabase-export-v2
72aa223866cdc029
$ python compare-strs.py length of first string= 1 length of second string= 2 True The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'.
trusted_official_docs
CPython Docs
$ python compare-strs.py length of first string= 1 length of second string= 2 True The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'.
$ python compare-strs.py length of first string= 1 length of second string= 2 True The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'.
python, official-docs, cpython, P0
Local_Trusted_Corpus
43f586d0-d7de-4de6-a8fe-ae0f776e63c3
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,331
supabase-export-v2
44d1cde049c7e184
these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems now. Tips for Writing Unicode-aware Programs ---------------------------------------
trusted_official_docs
CPython Docs
these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems now. Tips for Writing Unicode-aware Programs ---------------------------------------
these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems now. Tips for Writing Unicode-aware Programs ---------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
4415b2ee-d43b-4503-9f96-0294233628ad
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,231
supabase-export-v2
89506a422b9f6125
the language's :class:`str` type contains Unicode characters, meaning any string created using ``"unicode rocks!"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode. The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal::
trusted_official_docs
CPython Docs
the language's :class:`str` type contains Unicode characters, meaning any string created using ``"unicode rocks!"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode. The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal::
the language's :class:`str` type contains Unicode characters, meaning any string created using ``"unicode rocks!"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode. The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal::
python, official-docs, cpython, P0
Local_Trusted_Corpus
446be097-2c6d-4e56-b8a1-10169bb8ddd6
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,309
supabase-export-v2
1066d8cd7f6f628e
natively. XML parsers often return Unicode data, for example. Many relational databases also support Unicode-valued columns and can return Unicode values from an SQL query. Unicode data is usually converted to a particular encoding before it gets written to disk or sent over a socket. It's possible to do all the work y...
trusted_official_docs
CPython Docs
natively. XML parsers often return Unicode data, for example. Many relational databases also support Unicode-valued columns and can return Unicode values from an SQL query. Unicode data is usually converted to a particular encoding before it gets written to disk or sent over a socket. It's possible to do all the work y...
natively. XML parsers often return Unicode data, for example. Many relational databases also support Unicode-valued columns and can return Unicode values from an SQL query. Unicode data is usually converted to a particular encoding before it gets written to disk or sent over a socket. It's possible to do all the work y...
python, official-docs, cpython, P0
Local_Trusted_Corpus
466c5eaa-c5db-4838-a13e-3fdc62958bfe
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,250
supabase-export-v2
cd1d857ee1f994e6
Unicode Literals in Python Source Code -------------------------------------- In Python source code, specific Unicode code points can be written using the ``\u`` escape sequence, which is followed by four hex digits giving the code point. The ``\U`` escape sequence is similar, but expects eight hex digits, not four::
trusted_official_docs
CPython Docs
Unicode Literals in Python Source Code -------------------------------------- In Python source code, specific Unicode code points can be written using the ``\u`` escape sequence, which is followed by four hex digits giving the code point. The ``\U`` escape sequence is similar, but expects eight hex digits, not four::
Unicode Literals in Python Source Code -------------------------------------- In Python source code, specific Unicode code points can be written using the ``\u`` escape sequence, which is followed by four hex digits giving the code point. The ``\U`` escape sequence is similar, but expects eight hex digits, not four::
python, official-docs, cpython, P0
Local_Trusted_Corpus
47836beb-3737-4b89-9a98-df7b9b79984e
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,255
supabase-export-v2
49f6881d3eeb472d
you declare the encoding being used. This is done by including a special comment as either the first or second line of the source file:: #!/usr/bin/env python # -*- coding: latin-1 -*-
trusted_official_docs
CPython Docs
you declare the encoding being used. This is done by including a special comment as either the first or second line of the source file:: #!/usr/bin/env python # -*- coding: latin-1 -*-
you declare the encoding being used. This is done by including a special comment as either the first or second line of the source file:: #!/usr/bin/env python # -*- coding: latin-1 -*-
python, official-docs, cpython, P0
Local_Trusted_Corpus
4b195a76-8de7-4c20-a453-8fdda644917d
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,341
supabase-export-v2
aebff314e7e4f7b7
new_f = codecs.StreamRecoder(f, # en/decoder: used by read() to encode its results and # by write() to decode its input. codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'), # reader/writer: used to read and write to the stream. codecs.getreader('latin-1'), codecs.getwriter('latin-1') )
trusted_official_docs
CPython Docs
new_f = codecs.StreamRecoder(f, # en/decoder: used by read() to encode its results and # by write() to decode its input. codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'), # reader/writer: used to read and write to the stream. codecs.getreader('latin-1'), codecs.getwriter('latin-1') )
new_f = codecs.StreamRecoder(f, # en/decoder: used by read() to encode its results and # by write() to decode its input. codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'), # reader/writer: used to read and write to the stream. codecs.getreader('latin-1'), codecs.getwriter('latin-1') )
python, official-docs, cpython, P0
Local_Trusted_Corpus
52666206-2ba0-4bb5-a868-c3aa43d1a982
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,237
supabase-export-v2
31a81348a93ead9c
DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '\u0394' In addition, one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an ...
trusted_official_docs
CPython Docs
DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '\u0394' In addition, one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an ...
DELTA}" # Using the character name '\u0394' >>> "\u0394" # Using a 16-bit hex value '\u0394' >>> "\U00000394" # Using a 32-bit hex value '\u0394' In addition, one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
531abc1c-3c03-41e1-9fae-3f4f659e6306
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,218
supabase-export-v2
b8d8a226d6ad9b94
is >= 128, it's turned into a sequence of two, three, or four bytes, where each byte of the sequence is between 128 and 255. UTF-8 has several convenient properties:
trusted_official_docs
CPython Docs
is >= 128, it's turned into a sequence of two, three, or four bytes, where each byte of the sequence is between 128 and 255. UTF-8 has several convenient properties:
is >= 128, it's turned into a sequence of two, three, or four bytes, where each byte of the sequence is between 128 and 255. UTF-8 has several convenient properties:
python, official-docs, cpython, P0
Local_Trusted_Corpus
565756e7-f1a9-40d8-948d-e4d27383f997
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,320
supabase-export-v2
5dcd6adc5848263d
:term:`filesystem encoding <filesystem encoding and error handler>`. if you've set the ``LANG`` or ``LC_CTYPE`` environment variables; if you haven't, the default encoding is again UTF-8. The :func:`sys.getfilesystemencoding` function returns the encoding to use on your current system, in case you want to do the encodi...
trusted_official_docs
CPython Docs
:term:`filesystem encoding <filesystem encoding and error handler>`. if you've set the ``LANG`` or ``LC_CTYPE`` environment variables; if you haven't, the default encoding is again UTF-8. The :func:`sys.getfilesystemencoding` function returns the encoding to use on your current system, in case you want to do the encodi...
:term:`filesystem encoding <filesystem encoding and error handler>`. if you've set the ``LANG`` or ``LC_CTYPE`` environment variables; if you haven't, the default encoding is again UTF-8. The :func:`sys.getfilesystemencoding` function returns the encoding to use on your current system, in case you want to do the encodi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
592d2df9-3ddc-4cfa-9e8a-2b01e0309b6f
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,245
supabase-export-v2
444a82a248653e2f
The opposite method of :meth:`bytes.decode` is :meth:`str.encode`, which returns a :class:`bytes` representation of the Unicode string, encoded in the requested *encoding*. The *errors* parameter is the same as the parameter of the :meth:`~bytes.decode` method but supports a few more possible handlers. As well as ``'st...
trusted_official_docs
CPython Docs
The opposite method of :meth:`bytes.decode` is :meth:`str.encode`, which returns a :class:`bytes` representation of the Unicode string, encoded in the requested *encoding*. The *errors* parameter is the same as the parameter of the :meth:`~bytes.decode` method but supports a few more possible handlers. As well as ``'st...
The opposite method of :meth:`bytes.decode` is :meth:`str.encode`, which returns a :class:`bytes` representation of the Unicode string, encoded in the requested *encoding*. The *errors* parameter is the same as the parameter of the :meth:`~bytes.decode` method but supports a few more possible handlers. As well as ``'st...
python, official-docs, cpython, P0
Local_Trusted_Corpus
595f35bc-8e19-42a2-bede-4d6057faa837
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,293
supabase-export-v2
3cdeffb4105f2aeb
or a string. For example, ``\d`` will match the characters ``[0-9]`` in bytes but in strings will match any character that's in the ``'Nd'`` category. The string in this example has the number 57 written in both Thai and Arabic numerals::
trusted_official_docs
CPython Docs
or a string. For example, ``\d`` will match the characters ``[0-9]`` in bytes but in strings will match any character that's in the ``'Nd'`` category. The string in this example has the number 57 written in both Thai and Arabic numerals::
or a string. For example, ``\d`` will match the characters ``[0-9]`` in bytes but in strings will match any character that's in the ``'Nd'`` category. The string in this example has the number 57 written in both Thai and Arabic numerals::
python, official-docs, cpython, P0
Local_Trusted_Corpus
597e3c38-b0a1-4b14-9b7e-46df888061f0
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,323
supabase-export-v2
1ee384b6b9084840
Functions in the :mod:`os` module such as :func:`os.stat` will also accept Unicode filenames. The :func:`os.listdir` function returns filenames, which raises an issue: should it return the Unicode version of filenames, or should it return bytes containing the encoded versions? :func:`os.listdir` can do both, depending ...
trusted_official_docs
CPython Docs
Functions in the :mod:`os` module such as :func:`os.stat` will also accept Unicode filenames. The :func:`os.listdir` function returns filenames, which raises an issue: should it return the Unicode version of filenames, or should it return bytes containing the encoded versions? :func:`os.listdir` can do both, depending ...
Functions in the :mod:`os` module such as :func:`os.stat` will also accept Unicode filenames. The :func:`os.listdir` function returns filenames, which raises an issue: should it return the Unicode version of filenames, or should it return bytes containing the encoded versions? :func:`os.listdir` can do both, depending ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a7a0018-38c7-4ad8-be4a-0a0f40f0cfc2
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,224
supabase-export-v2
ca8fd067c456f84e
On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 <https://www.youtube.com/watch?v=MijmeoH9LT4>`_ (9 minutes 36 seconds). To help understand the standard, Jukka Korpela has written `an introductory guide <https://jkorpela.fi/unicode/guide.html>`_ to reading the Unicode ...
trusted_official_docs
CPython Docs
On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 <https://www.youtube.com/watch?v=MijmeoH9LT4>`_ (9 minutes 36 seconds). To help understand the standard, Jukka Korpela has written `an introductory guide <https://jkorpela.fi/unicode/guide.html>`_ to reading the Unicode ...
On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 <https://www.youtube.com/watch?v=MijmeoH9LT4>`_ (9 minutes 36 seconds). To help understand the standard, Jukka Korpela has written `an introductory guide <https://jkorpela.fi/unicode/guide.html>`_ to reading the Unicode ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5cbd40db-6243-40ba-8b86-91e4742b53e6
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,339
supabase-export-v2
1b052891d6608ee8
class can transparently convert between encodings, taking a stream that returns data in encoding #1 and behaving like a stream returning data in encoding #2. For example, if you have an input file *f* that's in Latin-1, you can wrap it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::
trusted_official_docs
CPython Docs
class can transparently convert between encodings, taking a stream that returns data in encoding #1 and behaving like a stream returning data in encoding #2. For example, if you have an input file *f* that's in Latin-1, you can wrap it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::
class can transparently convert between encodings, taking a stream that returns data in encoding #1 and behaving like a stream returning data in encoding #2. For example, if you have an input file *f* that's in Latin-1, you can wrap it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::
python, official-docs, cpython, P0
Local_Trusted_Corpus
5f69f0f3-e3d8-426e-a61e-7cdf76543c63
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,201
supabase-export-v2
a6180706e5de8398
the standard and in this document, a code point is written using the notation ``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal). The Unicode standard contains a lot of tables listing characters and their corresponding code points:
trusted_official_docs
CPython Docs
the standard and in this document, a code point is written using the notation ``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal). The Unicode standard contains a lot of tables listing characters and their corresponding code points:
the standard and in this document, a code point is written using the notation ``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal). The Unicode standard contains a lot of tables listing characters and their corresponding code points:
python, official-docs, cpython, P0
Local_Trusted_Corpus
65691fcb-f44a-4e0a-86ca-bc3601d67595
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,284
supabase-export-v2
c62c836562c0a3d3
The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'. The Unicode Standard also specifies how to do caseless comparisons::
trusted_official_docs
CPython Docs
The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'. The Unicode Standard also specifies how to do caseless comparisons::
The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'. The Unicode Standard also specifies how to do caseless comparisons::
python, official-docs, cpython, P0
Local_Trusted_Corpus
675cfec4-ee80-4357-8b2e-abc9c2f145e9
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,217
supabase-export-v2
b537a2b20aca35e0
are used in the encoding. (There are also UTF-16 and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 uses the following rules: 1. If the code point is < 128, it's represented by the corresponding byte value. 2. If the code point is >= 128, it's turned into a sequence of two, three, or four bytes...
trusted_official_docs
CPython Docs
are used in the encoding. (There are also UTF-16 and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 uses the following rules: 1. If the code point is < 128, it's represented by the corresponding byte value. 2. If the code point is >= 128, it's turned into a sequence of two, three, or four bytes...
are used in the encoding. (There are also UTF-16 and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 uses the following rules: 1. If the code point is < 128, it's represented by the corresponding byte value. 2. If the code point is >= 128, it's turned into a sequence of two, three, or four bytes...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6bb7043d-54bf-4ed5-a9e1-a723334c71a5
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,205
supabase-export-v2
67018afa26fe4f3b
in this case, it represents the character 'BLACK CHESS KNIGHT', '♞'. In informal contexts, this distinction between code points and characters will sometimes be forgotten. A character is represented on a screen or on paper by a set of graphical elements that's called a **glyph**. The glyph for an uppercase A, for examp...
trusted_official_docs
CPython Docs
in this case, it represents the character 'BLACK CHESS KNIGHT', '♞'. In informal contexts, this distinction between code points and characters will sometimes be forgotten. A character is represented on a screen or on paper by a set of graphical elements that's called a **glyph**. The glyph for an uppercase A, for examp...
in this case, it represents the character 'BLACK CHESS KNIGHT', '♞'. In informal contexts, this distinction between code points and characters will sometimes be forgotten. A character is represented on a screen or on paper by a set of graphical elements that's called a **glyph**. The glyph for an uppercase A, for examp...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6bf67bac-ee7b-4b89-9296-2fac715bd835
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,220
supabase-export-v2
344ded78186e7a68
UTF-8. 6. UTF-8 is a byte oriented encoding. The encoding specifies that each character is represented by a specific sequence of one or more bytes. This avoids the byte-ordering issues that can occur with integer and word oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes varies depending on the...
trusted_official_docs
CPython Docs
UTF-8. 6. UTF-8 is a byte oriented encoding. The encoding specifies that each character is represented by a specific sequence of one or more bytes. This avoids the byte-ordering issues that can occur with integer and word oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes varies depending on the...
UTF-8. 6. UTF-8 is a byte oriented encoding. The encoding specifies that each character is represented by a specific sequence of one or more bytes. This avoids the byte-ordering issues that can occur with integer and word oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes varies depending on the...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6d504695-226b-48e1-943c-65b1cd09ade3
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,317
supabase-export-v2
088934079aab8bd2
variants of these encodings, such as 'utf-16-le' and 'utf-16-be' for little-endian and big-endian encodings, that specify one particular byte ordering and don't skip the BOM. In some areas, it is also convention to use a "BOM" at the start of UTF-8 encoded files; the name is misleading since UTF-8 is not byte-order dep...
trusted_official_docs
CPython Docs
variants of these encodings, such as 'utf-16-le' and 'utf-16-be' for little-endian and big-endian encodings, that specify one particular byte ordering and don't skip the BOM. In some areas, it is also convention to use a "BOM" at the start of UTF-8 encoded files; the name is misleading since UTF-8 is not byte-order dep...
variants of these encodings, such as 'utf-16-le' and 'utf-16-be' for little-endian and big-endian encodings, that specify one particular byte ordering and don't skip the BOM. In some areas, it is also convention to use a "BOM" at the start of UTF-8 encoded files; the name is misleading since UTF-8 is not byte-order dep...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7854496c-2cf1-4526-9a22-b7202592d46e
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,310
supabase-export-v2
ddea56486d722fde
work yourself: open a file, read an 8-bit bytes object from it, and convert the bytes with ``bytes.decode(encoding)``. However, the manual approach is not recommended. One problem is the multi-byte nature of encodings; one Unicode character can be represented by several bytes. If you want to read the file in arbitrary-...
trusted_official_docs
CPython Docs
work yourself: open a file, read an 8-bit bytes object from it, and convert the bytes with ``bytes.decode(encoding)``. However, the manual approach is not recommended. One problem is the multi-byte nature of encodings; one Unicode character can be represented by several bytes. If you want to read the file in arbitrary-...
work yourself: open a file, read an 8-bit bytes object from it, and convert the bytes with ``bytes.decode(encoding)``. However, the manual approach is not recommended. One problem is the multi-byte nature of encodings; one Unicode character can be represented by several bytes. If you want to read the file in arbitrary-...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7b6990dc-d504-4f3f-8237-7d8655bdd622
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,335
supabase-export-v2
d51168c507a0fc39
Software should only work with Unicode strings internally, decoding the input data as soon as possible and encoding the output only at the end. If you attempt to write processing functions that accept both Unicode and byte strings, you will find your program vulnerable to bugs wherever you combine the two different kin...
trusted_official_docs
CPython Docs
Software should only work with Unicode strings internally, decoding the input data as soon as possible and encoding the output only at the end. If you attempt to write processing functions that accept both Unicode and byte strings, you will find your program vulnerable to bugs wherever you combine the two different kin...
Software should only work with Unicode strings internally, decoding the input data as soon as possible and encoding the output only at the end. If you attempt to write processing functions that accept both Unicode and byte strings, you will find your program vulnerable to bugs wherever you combine the two different kin...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7b8a049b-ac82-4f68-9d32-1cb8918f6cfb
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,297
supabase-export-v2
4458c6b476dd5c3e
``\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\d+`` will match the substring "57" instead. Similarly, ``\w`` matches a wide variety of Unicode characters but only ``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\s`` will ...
trusted_official_docs
CPython Docs
``\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\d+`` will match the substring "57" instead. Similarly, ``\w`` matches a wide variety of Unicode characters but only ``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\s`` will ...
``\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\d+`` will match the substring "57" instead. Similarly, ``\w`` matches a wide variety of Unicode characters but only ``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\s`` will ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
7f12f8d4-909c-49e4-b19b-48a6ea494256
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,319
supabase-export-v2
45a86c04bb03193e
Unicode filenames ----------------- Most of the operating systems in common use today support filenames that contain arbitrary Unicode characters. Usually this is implemented by converting the Unicode string into some encoding that varies depending on the system. Today Python is converging on using UTF-8: Python on Mac...
trusted_official_docs
CPython Docs
Unicode filenames ----------------- Most of the operating systems in common use today support filenames that contain arbitrary Unicode characters. Usually this is implemented by converting the Unicode string into some encoding that varies depending on the system. Today Python is converging on using UTF-8: Python on Mac...
Unicode filenames ----------------- Most of the operating systems in common use today support filenames that contain arbitrary Unicode characters. Usually this is implemented by converting the Unicode string into some encoding that varies depending on the system. Today Python is converging on using UTF-8: Python on Mac...
python, official-docs, cpython, P0
Local_Trusted_Corpus
84bfdfcc-f2bd-4352-a17b-4d40702a622a
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,198
supabase-export-v2
79a65a72545a6c04
variety of emoji symbols. Python's string type uses the Unicode Standard for representing characters, which lets Python programs work with all these different possible characters. Unicode (https://www.unicode.org/) is a specification that aims to list every character used by human languages and give each character its ...
trusted_official_docs
CPython Docs
variety of emoji symbols. Python's string type uses the Unicode Standard for representing characters, which lets Python programs work with all these different possible characters. Unicode (https://www.unicode.org/) is a specification that aims to list every character used by human languages and give each character its ...
variety of emoji symbols. Python's string type uses the Unicode Standard for representing characters, which lets Python programs work with all these different possible characters. Unicode (https://www.unicode.org/) is a specification that aims to list every character used by human languages and give each character its ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8874d3f2-6c01-4b65-999d-54fb660aea21
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,262
supabase-export-v2
01d0bf30e452634c
Roman numerals, fractions such as one-third and four-fifths, etc.). There are also display-related properties, such as how to use the code point in bidirectional text. The following program displays some information about several characters, and prints the numeric value of one particular character::
trusted_official_docs
CPython Docs
Roman numerals, fractions such as one-third and four-fifths, etc.). There are also display-related properties, such as how to use the code point in bidirectional text. The following program displays some information about several characters, and prints the numeric value of one particular character::
Roman numerals, fractions such as one-third and four-fifths, etc.). There are also display-related properties, such as how to use the code point in bidirectional text. The following program displays some information about several characters, and prints the numeric value of one particular character::
python, official-docs, cpython, P0
Local_Trusted_Corpus
8e3d8e40-d8ec-4077-a7d6-be4e2894b7a9
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,238
supabase-export-v2
26843a6baaa4fefb
one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an *errors* argument. The *errors* argument specifies the response when the input string can't be converted according to the encoding's rules. Legal values for th...
trusted_official_docs
CPython Docs
one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an *errors* argument. The *errors* argument specifies the response when the input string can't be converted according to the encoding's rules. Legal values for th...
one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an *errors* argument. The *errors* argument specifies the response when the input string can't be converted according to the encoding's rules. Legal values for th...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8e636eaf-7d35-4005-936d-7dbc88ffa7d6
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,257
supabase-export-v2
05966b1832a9e876
u = 'abcdé' print(ord(u[-1])) The syntax is inspired by Emacs's notation for specifying variables local to a file. Emacs supports many different variables, but Python only supports 'coding'. The ``-*-`` symbols indicate to Emacs that the comment is special; they have no significance to Python but are a convention. Pyth...
trusted_official_docs
CPython Docs
u = 'abcdé' print(ord(u[-1])) The syntax is inspired by Emacs's notation for specifying variables local to a file. Emacs supports many different variables, but Python only supports 'coding'. The ``-*-`` symbols indicate to Emacs that the comment is special; they have no significance to Python but are a convention. Pyth...
u = 'abcdé' print(ord(u[-1])) The syntax is inspired by Emacs's notation for specifying variables local to a file. Emacs supports many different variables, but Python only supports 'coding'. The ``-*-`` symbols indicate to Emacs that the comment is special; they have no significance to Python but are a convention. Pyth...
python, official-docs, cpython, P0
Local_Trusted_Corpus
90dd0767-29e9-4d6a-af32-87197a2875d8
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,253
supabase-export-v2
36a84ed21a11a286
with messages in French or some other accent-using language. You can also assemble strings using the :func:`chr` built-in function, but this is even more tedious. Ideally, you'd want to be able to write literals in your language's natural encoding. You could then edit Python source code with your favorite editor which ...
trusted_official_docs
CPython Docs
with messages in French or some other accent-using language. You can also assemble strings using the :func:`chr` built-in function, but this is even more tedious. Ideally, you'd want to be able to write literals in your language's natural encoding. You could then edit Python source code with your favorite editor which ...
with messages in French or some other accent-using language. You can also assemble strings using the :func:`chr` built-in function, but this is even more tedious. Ideally, you'd want to be able to write literals in your language's natural encoding. You could then edit Python source code with your favorite editor which ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
934c581e-918d-4692-a408-0cf832500b86
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,275
supabase-export-v2
8c1a1fc7256b5255
>>> street = 'Gürzenichstraße' >>> street.casefold() 'gürzenichstrasse' A second tool is the :mod:`unicodedata` module's :func:`~unicodedata.normalize` function that converts strings to one of several normal forms, where letters followed by a combining character are replaced with single characters. :func:`~unicodedata....
trusted_official_docs
CPython Docs
>>> street = 'Gürzenichstraße' >>> street.casefold() 'gürzenichstrasse' A second tool is the :mod:`unicodedata` module's :func:`~unicodedata.normalize` function that converts strings to one of several normal forms, where letters followed by a combining character are replaced with single characters. :func:`~unicodedata....
>>> street = 'Gürzenichstraße' >>> street.casefold() 'gürzenichstrasse' A second tool is the :mod:`unicodedata` module's :func:`~unicodedata.normalize` function that converts strings to one of several normal forms, where letters followed by a combining character are replaced with single characters. :func:`~unicodedata....
python, official-docs, cpython, P0
Local_Trusted_Corpus
94148c75-9dab-4979-a0ba-82fc0362bc07
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,203
supabase-export-v2
e918fb3c40b2bb0b
.. code-block:: none 0061 'a'; LATIN SMALL LETTER A 0062 'b'; LATIN SMALL LETTER B 0063 'c'; LATIN SMALL LETTER C ... 007B '{'; LEFT CURLY BRACKET ... 2167 'Ⅷ'; ROMAN NUMERAL EIGHT 2168 'Ⅸ'; ROMAN NUMERAL NINE ... 265E '♞'; BLACK CHESS KNIGHT 265F '♟'; BLACK CHESS PAWN ... 1F600 '😀'; GRINNING FACE 1F609 '😉';...
trusted_official_docs
CPython Docs
.. code-block:: none 0061 'a'; LATIN SMALL LETTER A 0062 'b'; LATIN SMALL LETTER B 0063 'c'; LATIN SMALL LETTER C ... 007B '{'; LEFT CURLY BRACKET ... 2167 'Ⅷ'; ROMAN NUMERAL EIGHT 2168 'Ⅸ'; ROMAN NUMERAL NINE ... 265E '♞'; BLACK CHESS KNIGHT 265F '♟'; BLACK CHESS PAWN ... 1F600 '😀'; GRINNING FACE 1F609 '😉';...
.. code-block:: none 0061 'a'; LATIN SMALL LETTER A 0062 'b'; LATIN SMALL LETTER B 0063 'c'; LATIN SMALL LETTER C ... 007B '{'; LEFT CURLY BRACKET ... 2167 'Ⅷ'; ROMAN NUMERAL EIGHT 2168 'Ⅸ'; ROMAN NUMERAL NINE ... 265E '♞'; BLACK CHESS KNIGHT 265F '♟'; BLACK CHESS PAWN ... 1F600 '😀'; GRINNING FACE 1F609 '😉';...
python, official-docs, cpython, P0
Local_Trusted_Corpus
96a4cbd8-d45f-4f8d-8b80-fd4b8d940f15
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,207
supabase-export-v2
b2ffabb2fed56611
Encodings --------- To summarize the previous section: a Unicode string is a sequence of code points, which are numbers from 0 through ``0x10FFFF`` (1,114,111 decimal). This sequence of code points needs to be represented in memory as a set of **code units**, and **code units** are then mapped to 8-bit bytes. The rules...
trusted_official_docs
CPython Docs
Encodings --------- To summarize the previous section: a Unicode string is a sequence of code points, which are numbers from 0 through ``0x10FFFF`` (1,114,111 decimal). This sequence of code points needs to be represented in memory as a set of **code units**, and **code units** are then mapped to 8-bit bytes. The rules...
Encodings --------- To summarize the previous section: a Unicode string is a sequence of code points, which are numbers from 0 through ``0x10FFFF`` (1,114,111 decimal). This sequence of code points needs to be represented in memory as a set of **code units**, and **code units** are then mapped to 8-bit bytes. The rules...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9f390cf1-1e79-4fc1-85cc-ce708fd765a1
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,232
supabase-export-v2
0ba19c2cced67957
The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal:: try: with open('/tmp/input.txt', 'r') as f: ... except OSError: # 'File not found' error message. print("Fichier non trouvé")
trusted_official_docs
CPython Docs
The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal:: try: with open('/tmp/input.txt', 'r') as f: ... except OSError: # 'File not found' error message. print("Fichier non trouvé")
The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal:: try: with open('/tmp/input.txt', 'r') as f: ... except OSError: # 'File not found' error message. print("Fichier non trouvé")
python, official-docs, cpython, P0
Local_Trusted_Corpus
a045eabe-9633-4539-95f2-66342fc00521
CPython Docs
file://datasets/cpython/Doc/howto/unicode.rst
unknown
e3d9546b-1d15-44b9-b8aa-aba88a473d8c
59,208
supabase-export-v2
fbbc49aa4fba90ec
mapped to 8-bit bytes. The rules for translating a Unicode string into a sequence of bytes are called a **character encoding**, or just an **encoding**. The first encoding you might think of is using 32-bit integers as the code unit, and then using the CPU's representation of 32-bit integers. In this representation, th...
trusted_official_docs
CPython Docs
mapped to 8-bit bytes. The rules for translating a Unicode string into a sequence of bytes are called a **character encoding**, or just an **encoding**. The first encoding you might think of is using 32-bit integers as the code unit, and then using the CPU's representation of 32-bit integers. In this representation, th...
mapped to 8-bit bytes. The rules for translating a Unicode string into a sequence of bytes are called a **character encoding**, or just an **encoding**. The first encoding you might think of is using 32-bit integers as the code unit, and then using the CPU's representation of 32-bit integers. In this representation, th...
python, official-docs, cpython, P0
Local_Trusted_Corpus