转换大写的unaccentent unicode字符 [英] Convert on uppercase unaccentent unicode character

查看:91
本文介绍了转换大写的unaccentent unicode字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是Python的新手。

目前我正试图将unicode角色转换成他的大写

非重音字符。

例如,使用语言环境fr_FR:

a,A,à,à应返回A

o,O,? ,?应该返回O

?,?应该回来吗?

我,我,?,?应该返回我


你有什么建议吗?


谢谢。

Hi,
I''am very newbie in Python.
For the moment I''am trying to convert an unicode character to his uppercase
unaccented character.
By example with locale fr_FR:
a,A,à,à should return A
o,O,?,? should return O
?,? should return ?
i,I,?,? should return I

Have you some suggestions ?

Thank.

推荐答案

10月4日上午7:35,JBJ< Jean-Bernard.jacquet-at-tele-deux-

点...... @ invalid.orgwrote:
On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:



我是Python的新手。

目前我正试图转换一个unicode字符到他的大写

unaccented字符。

例如使用locale fr_FR:

a,A,à,à应返回A

o,O,?,?应该返回O

?,?应该回来吗?

我,我,?,?应该返回我


你有什么建议吗?


谢谢。
Hi,
I''am very newbie in Python.
For the moment I''am trying to convert an unicode character to his uppercase
unaccented character.
By example with locale fr_FR:
a,A,à,à should return A
o,O,?,? should return O
?,? should return ?
i,I,?,? should return I

Have you some suggestions ?

Thank.



Unicode字符串有一个upper()方法 - 试试看。我认为

应该适合您的语言环境 - 对于我来说,使用英语语言环境并没有给出预期的

结果。

Unicode strings have an upper() method - try that. I''m think it
should work properly with your locale - it doesn''t give the expected
result for me with an english locale.


ti******@gmail.com

10月4日上午7:35,JBJ< Jean-Bernard.jacquet-at-tele-deux-

点... @ invalid.orgwrote:
On Oct 4, 7:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:

>
我是Python的新手。
目前我' '我正在尝试将一个unicode角色转换为他的
大写无重音角色。
例如,使用locale fr_FR:
a,A,à,à应返回A
o,O, ?,?应该返回O
?,?应该回来?
我,我,?,?应该回复我

你有什么建议吗?

谢谢。
>Hi,
I''am very newbie in Python.
For the moment I''am trying to convert an unicode character to his
uppercase unaccented character.
By example with locale fr_FR:
a,A,à,à should return A
o,O,?,? should return O
?,? should return ?
i,I,?,? should return I

Have you some suggestions ?

Thank.



Unicode字符串有一个upper()方法 - 尝试一下。我认为

应该适合您的语言环境 - 对于我来说,使用英语语言环境并没有给出预期的

结果。


Unicode strings have an upper() method - try that. I''m think it
should work properly with your locale - it doesn''t give the expected
result for me with an english locale.



不,这将使字符串大写,但它不会(也不应该)剥离

重音符号:

No, that will uppercase the string, but it doesn''t (and shouldn''t) strip
the accents:


>> s = u''''''通过语言环境示例fr_FR:
>>s = u''''''By example with locale fr_FR:



a,A,à,à应返回A

o,O,?,?应该返回O

?,?应该回来吗?

我,我,?,?应该返回我''''

a,A,à,à should return A
o,O,?,? should return O
?,? should return ?
i,I,?,? should return I''''''


>> print s.upper( )
>>print s.upper()



通过示例与LOCALE FR_FR:

A,A,à,à应该返回

O,O,?,?应该退还O $ / $
?,?应该回来吗?

我,我,?,?应该返回我

BY EXAMPLE WITH LOCALE FR_FR:
A,A,à,à SHOULD RETURN A
O,O,?,? SHOULD RETURN O
?,? SHOULD RETURN ?
I,I,?,? SHOULD RETURN I


>>>
>>>



我想也许我的新阅读器损坏了第三行。当我发送它时,它可能会腐蚀所有其他人。

I guess maybe my newreader corrupted the third line. It probably corrupts
all the others when I send this.


10月4日凌晨4:35,JBJ< Jean-Bernard。 jacquet-at-tele-deux-

point ... @ invalid.orgwrote:
On Oct 4, 4:35 am, JBJ <Jean-Bernard.jacquet-at-tele-deux-
point...@invalid.orgwrote:



我是Python的新手。

目前我正在尝试将unicode角色转换为他的大写字符

非重音角色。

举例来说,语言环境fr_FR:

a,A,à,à应该返回A

o,O,?,?应该返回O

?,?应该回来吗?

我,我,?,?应该返回我


你有什么建议吗?


谢谢。
Hi,
I''am very newbie in Python.
For the moment I''am trying to convert an unicode character to his uppercase
unaccented character.
By example with locale fr_FR:
a,A,à,à should return A
o,O,?,? should return O
?,? should return ?
i,I,?,? should return I

Have you some suggestions ?

Thank.



此新闻组中Google以bussiere开头的线程在2006-03-25关于或者

。 Fredrik Lundh提供的代码片段应该

帮助你。

Google in this newsgroup for a thread started by "bussiere" on or
about 2006-03-25. The code snippet provided by Fredrik Lundh should
help you.


这篇关于转换大写的unaccentent unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆