Printing a utf-8 character to console
up vote
3
down vote
favorite
I'm trying to print a utf-8 character to console.
Isn't this supposed to work?
python encoding utf-8 console
add a comment |
up vote
3
down vote
favorite
I'm trying to print a utf-8 character to console.
Isn't this supposed to work?
python encoding utf-8 console
Note the first string isbytes
while the second isn't
– C.Nivs
Nov 21 at 3:26
3
b'xc3x91'.decode()
should print it!
– bro-grammer
Nov 21 at 3:27
@bro-grammer thanks! if you write this as an answer I can mark it correct :)
– Pablo Fernandez
Nov 21 at 3:31
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I'm trying to print a utf-8 character to console.
Isn't this supposed to work?
python encoding utf-8 console
I'm trying to print a utf-8 character to console.
Isn't this supposed to work?
python encoding utf-8 console
python encoding utf-8 console
asked Nov 21 at 3:24
Pablo Fernandez
67.6k46166217
67.6k46166217
Note the first string isbytes
while the second isn't
– C.Nivs
Nov 21 at 3:26
3
b'xc3x91'.decode()
should print it!
– bro-grammer
Nov 21 at 3:27
@bro-grammer thanks! if you write this as an answer I can mark it correct :)
– Pablo Fernandez
Nov 21 at 3:31
add a comment |
Note the first string isbytes
while the second isn't
– C.Nivs
Nov 21 at 3:26
3
b'xc3x91'.decode()
should print it!
– bro-grammer
Nov 21 at 3:27
@bro-grammer thanks! if you write this as an answer I can mark it correct :)
– Pablo Fernandez
Nov 21 at 3:31
Note the first string is
bytes
while the second isn't– C.Nivs
Nov 21 at 3:26
Note the first string is
bytes
while the second isn't– C.Nivs
Nov 21 at 3:26
3
3
b'xc3x91'.decode()
should print it!– bro-grammer
Nov 21 at 3:27
b'xc3x91'.decode()
should print it!– bro-grammer
Nov 21 at 3:27
@bro-grammer thanks! if you write this as an answer I can mark it correct :)
– Pablo Fernandez
Nov 21 at 3:31
@bro-grammer thanks! if you write this as an answer I can mark it correct :)
– Pablo Fernandez
Nov 21 at 3:31
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The former statement prints the value as bytes
while the latter statement uses a string
value. Changing it to bytes
will give you the required output.
>>> b'xc3x91'.decode()
>>> 'Ñ'
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The former statement prints the value as bytes
while the latter statement uses a string
value. Changing it to bytes
will give you the required output.
>>> b'xc3x91'.decode()
>>> 'Ñ'
add a comment |
up vote
1
down vote
accepted
The former statement prints the value as bytes
while the latter statement uses a string
value. Changing it to bytes
will give you the required output.
>>> b'xc3x91'.decode()
>>> 'Ñ'
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The former statement prints the value as bytes
while the latter statement uses a string
value. Changing it to bytes
will give you the required output.
>>> b'xc3x91'.decode()
>>> 'Ñ'
The former statement prints the value as bytes
while the latter statement uses a string
value. Changing it to bytes
will give you the required output.
>>> b'xc3x91'.decode()
>>> 'Ñ'
edited Nov 21 at 3:40
Pablo Fernandez
67.6k46166217
67.6k46166217
answered Nov 21 at 3:33
bro-grammer
3,02211230
3,02211230
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404825%2fprinting-a-utf-8-character-to-console%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Note the first string is
bytes
while the second isn't– C.Nivs
Nov 21 at 3:26
3
b'xc3x91'.decode()
should print it!– bro-grammer
Nov 21 at 3:27
@bro-grammer thanks! if you write this as an answer I can mark it correct :)
– Pablo Fernandez
Nov 21 at 3:31