Python论坛  - 讨论区

标题:[python-chinese] 字符串,当整型来处理??

2007年06月25日 星期一 17:13

Neo Chen openunix在163.com
星期一 六月 25 17:13:33 HKT 2007

"9/5" ×Ö·û´®.

ÎÒÏë¼ÆËã 9/5 = 1.8 ??
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/48d4434a/attachment.html 
-------------- 下一部分 --------------
Ò»¸ö·ÇÎı¾¸½¼þ±»Çå³ý...
·¢ÐÅÈË: %(who)s
Ö÷Ìâ: %(subject)s
ÈÕÆÚ: %(date)s
´óС: 1325
Url: http://python.cn/pipermail/python-chinese/attachments/20070625/48d4434a/attachment.bin 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 17:16

Tian askfor在gmail.com
星期一 六月 25 17:16:43 HKT 2007

eval °É

On 6/25/07, Neo Chen <openunix在163.com> wrote:
>
>  "9/5" ×Ö·û´®.
>
> ÎÒÏë¼ÆËã 9/5 = 1.8 ??
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/a9c95170/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 17:18

lai yonghao lanphaday在gmail.com
星期一 六月 25 17:18:16 HKT 2007

i = eval('9.0/5.0')
print i
1.8


ÔÚ07-6-25£¬Neo Chen <openunix在163.com> дµÀ£º
>
>  "9/5" ×Ö·û´®.
>
> ÎÒÏë¼ÆËã 9/5 = 1.8 ??
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/275264c3/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 17:20

Liming_Do Liming_Do在smics.com
星期一 六月 25 17:20:42 HKT 2007

Ö±½ÓevalµÃ1£¬µÃ²»³ö1.8
>>> eval('9.0/5')
1.8

-----Original Message-----
From: python-chinese-bounces在lists.python.cn [mailto:python-chinese-bounces在lists.python.cn]On Behalf Of Tian
Sent: Monday, June 25, 2007 5:17 PM
To: python-chinese在lists.python.cn
Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??


eval °É


On 6/25/07, Neo Chen < openunix在163.com> wrote: 

"9/5" ×Ö·û´®.
 
ÎÒÏë¼ÆËã 9/5 = 1.8 ??

_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to   python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese




-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/64ff59cd/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 17:20

Neo Chen openunix在163.com
星期一 六月 25 17:20:46 HKT 2007

½á¹û²»¶Ô?

>>> int(eval('9/5'))
1
>>> float(eval('9/5'))
1.0
  ----- Original Message ----- 
  From: Tian 
  To: python-chinese在lists.python.cn 
  Sent: Monday, June 25, 2007 5:16 PM
  Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??


  eval °É


  On 6/25/07, Neo Chen <openunix在163.com> wrote: 
    "9/5" ×Ö·û´®.

    ÎÒÏë¼ÆËã 9/5 = 1.8 ??

    _______________________________________________
    python-chinese
    Post: send python-chinese在lists.python.cn
    Subscribe: send subscribe to python-chinese-request在lists.python.cn
    Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese






------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese在lists.python.cn
  Subscribe: send subscribe to python-chinese-request在lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/8ef0fa13/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 18:21

Neo Chen openunix在163.com
星期一 六月 25 18:21:49 HKT 2007

ÕâÑùÎÒ»¹µÃ×öÒ»´Î×Ö·û´®´úÌæ? :(
  ----- Original Message ----- 
  From: Liming_Do 
  To: python-chinese在lists.python.cn 
  Sent: Monday, June 25, 2007 5:20 PM
  Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??


  Ö±½ÓevalµÃ1£¬µÃ²»³ö1.8
  >>> eval('9.0/5')
  1.8
    -----Original Message-----
    From: python-chinese-bounces在lists.python.cn [mailto:python-chinese-bounces在lists.python.cn]On Behalf Of Tian
    Sent: Monday, June 25, 2007 5:17 PM
    To: python-chinese在lists.python.cn
    Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??


    eval °É


    On 6/25/07, Neo Chen <openunix在163.com> wrote: 
      "9/5" ×Ö·û´®.

      ÎÒÏë¼ÆËã 9/5 = 1.8 ??

      _______________________________________________
      python-chinese
      Post: send python-chinese在lists.python.cn
      Subscribe: send subscribe to python-chinese-request在lists.python.cn
      Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
      Detail Info: http://python.cn/mailman/listinfo/python-chinese






------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese在lists.python.cn
  Subscribe: send subscribe to python-chinese-request在lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/c0d4e318/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 18:49

Leo Jay python.leojay在gmail.com
星期一 六月 25 18:49:10 HKT 2007

On 6/25/07, Neo Chen <openunix在163.com> wrote:
>
>
> "9/5" 字符串.
>
> 我想计算 9/5 = 1.8 ??


在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
要么你就自己写解析的程序。


-- 
Best Regards,
Leo Jay

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 19:02

Qiangning Hong hongqn在gmail.com
星期一 六月 25 19:02:43 HKT 2007

On 6/25/07, Leo Jay <python.leojay在gmail.com> wrote:
> On 6/25/07, Neo Chen <openunix在163.com> wrote:
> > "9/5" 字符串.
> > 我想计算 9/5 = 1.8 ??
>
> 在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
> 要么你就自己写解析的程序。

看看这个 ;)

.>>> from __future__ import division
.>>> eval('9/5')
1.8

-- 
Qiangning Hong
http://www.douban.com/people/hongqn/

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 19:33

Liming_Do Liming_Do在smics.com
星期一 六月 25 19:33:12 HKT 2007

赞!
On 6/25/07, Leo Jay <python.leojay在gmail.com> wrote:
> On 6/25/07, Neo Chen <openunix在163.com> wrote:
> > "9/5" 字符串.
> > 我想计算 9/5 = 1.8 ??
>
> 在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
> 要么你就自己写解析的程序。

看看这个 ;)

.>>> from __future__ import division
.>>> eval('9/5')
1.8

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 19:37

Liming_Do Liming_Do在smics.com
星期一 六月 25 19:37:57 HKT 2007

µ±È»qiangningµÄ·½·¨ÊÇ×îºÃ
Èç¹ûÓÃÍÁ°ì·¨Ò²Óò»×ÅÌæ»»£¬
·´Õý¶¼ÊÇÊý×Ö£¬Ö±½Ó×Ö·û´®Á¬½Ó¾Í¿ÉÒÔ
>>> eval('9/5' + '.0')
1.8

-----Original Message-----
From: python-chinese-bounces在lists.python.cn [mailto:python-chinese-bounces在lists.python.cn]On Behalf Of Neo Chen
Sent: Monday, June 25, 2007 6:22 PM
To: python-chinese在lists.python.cn
Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??


ÕâÑùÎÒ»¹µÃ×öÒ»´Î×Ö·û´®´úÌæ? :(

----- Original Message ----- 
From: Liming_Do Liming_Do在smics.com>  
To: python-chinese在lists.python.cn 
Sent: Monday, June 25, 2007 5:20 PM
Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??

Ö±½ÓevalµÃ1£¬µÃ²»³ö1.8
>>> eval('9.0/5')
1.8

-----Original Message-----
From: python-chinese-bounces在lists.python.cn [mailto:python-chinese-bounces在lists.python.cn]On Behalf Of Tian
Sent: Monday, June 25, 2007 5:17 PM
To: python-chinese在lists.python.cn
Subject: Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??


eval °É


On 6/25/07, Neo Chen < openunix在163.com> wrote: 

"9/5" ×Ö·û´®.
 
ÎÒÏë¼ÆËã 9/5 = 1.8 ??

_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to   python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese






  _____  




_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/54656311/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 19:43

Jarymin jarymin在gmail.com
星期一 六月 25 19:43:46 HKT 2007

太NB了

在 Mon, 25 Jun 2007 19:33:12 +0800,Liming_Do <Liming_Do在smics.com> 写道:

> 赞!
> On 6/25/07, Leo Jay <python.leojay在gmail.com> wrote:
>> On 6/25/07, Neo Chen <openunix在163.com> wrote:
>> > "9/5" 字符串.
>> > 我想计算 9/5 = 1.8 ??
>>
>> 在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
>> 要么你就自己写解析的程序。
>
> 看看这个 ;)
>
> .>>> from __future__ import division
> .>>> eval('9/5')
> 1.8
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese



-- 
Thanks!

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 19:44

Jarymin jarymin在gmail.com
星期一 六月 25 19:44:16 HKT 2007

Thanks!

在 Mon, 25 Jun 2007 19:33:12 +0800,Liming_Do <Liming_Do在smics.com> 写道:

> 赞!
> On 6/25/07, Leo Jay <python.leojay在gmail.com> wrote:
>> On 6/25/07, Neo Chen <openunix在163.com> wrote:
>> > "9/5" 字符串.
>> > 我想计算 9/5 = 1.8 ??
>>
>> 在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
>> 要么你就自己写解析的程序。
>
> 看看这个 ;)
>
> .>>> from __future__ import division
> .>>> eval('9/5')
> 1.8
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese



-- 
Thanks!

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月25日 星期一 20:29

马宏亮 mhl1983在gmail.com
星期一 六月 25 20:29:14 HKT 2007

zan!

ÔÚ07-6-25£¬Qiangning Hong <hongqn在gmail.com> дµÀ£º
>
> On 6/25/07, Leo Jay <python.leojay在gmail.com> wrote:
> > On 6/25/07, Neo Chen <openunix在163.com> wrote:
> > > "9/5" ×Ö·û´®.
> > > ÎÒÏë¼ÆËã 9/5 = 1.8 ??
> >
> > ÔÚpythonÀ9/5µÄ½á¹û¾ÍÊÇ1£¬ËùÒÔÄã²»¿ÉÄÜÖ±½ÓÓÉevalµÃµ½1.8µÄ½á¹û¡£
> > ҪôÄã¾Í×Ô¼ºÐ´½âÎöµÄ³ÌÐò¡£
>
> ¿´¿´Õâ¸ö ;)
>
> .>>> from __future__ import division
> .>>> eval('9/5')
> 1.8
>
> --
> Qiangning Hong
> http://www.douban.com/people/hongqn/
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese




-- 
ÂíºêÁÁ
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070625/cff6ef0a/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月26日 星期二 00:55

limon lin limon7在gmail.com
星期二 六月 26 00:55:06 HKT 2007

8错8错

在07-6-25,马宏亮 <mhl1983 at gmail.com> 写道:
>
> zan!
>
> 在07-6-25,Qiangning Hong <hongqn at gmail.com> 写道:
> >
> > On 6/25/07, Leo Jay <python.leojay at gmail.com> wrote:
> > > On 6/25/07, Neo Chen <openunix at 163.com> wrote:
> > > > "9/5" 字符串.
> > > > 我想计算 9/5 = 1.8 ??
> > >
> > > 在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
> > > 要么你就自己写解析的程序。
> >
> > 看看这个 ;)
> >
> > .>>> from __future__ import division
> > .>>> eval('9/5')
> > 1.8
> >
> > --
> > Qiangning Hong
> > http://www.douban.com/people/hongqn/
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> --
> 马宏亮
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20070626/04c4ffbd/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月26日 星期二 10:01

Neo Chen openunix在163.com
星期二 六月 26 10:01:40 HKT 2007

非常感谢,这是最佳方案.


----- Original Message ----- 
From: "Qiangning Hong" <hongqn在gmail.com>
To: <python-chinese在lists.python.cn>
Sent: Monday, June 25, 2007 7:02 PM
Subject: Re: [python-chinese] 字符串,当整型来处理??


> On 6/25/07, Leo Jay <python.leojay在gmail.com> wrote:
>> On 6/25/07, Neo Chen <openunix在163.com> wrote:
>> > "9/5" 字符串.
>> > 我想计算 9/5 = 1.8 ??
>>
>> 在python里,9/5的结果就是1,所以你不可能直接由eval得到1.8的结果。
>> 要么你就自己写解析的程序。
> 
> 看看这个 ;)
> 
> .>>> from __future__ import division
> .>>> eval('9/5')
> 1.8
> 
> -- 
> Qiangning Hong
> http://www.douban.com/people/hongqn/
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月26日 星期二 14:55

purpen.w purpen.w在gmail.com
星期二 六月 26 14:55:59 HKT 2007

Ö±½ÓÓÃfloat()ת»»³É¸¡µãÐ͵ÄÔÙ×÷ÔËËã,Ò²ÐеÄ.

ÔÚ07-6-25£¬Neo Chen <openunix在163.com> дµÀ£º
>
>  ÕâÑùÎÒ»¹µÃ×öÒ»´Î×Ö·û´®´úÌæ? :(
>
> ----- Original Message -----
> *From:* Liming_Do <Liming_Do在smics.com>
> *To:* python-chinese在lists.python.cn
> *Sent:* Monday, June 25, 2007 5:20 PM
> *Subject:* Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??
>
> Ö±½ÓevalµÃ1£¬µÃ²»³ö1.8
> >>> eval('9.0/5')
> 1.8
>
> -----Original Message-----
> *From:* python-chinese-bounces在lists.python.cn [mailto:
> python-chinese-bounces在lists.python.cn]*On Behalf Of *Tian
> *Sent:* Monday, June 25, 2007 5:17 PM
> *To:* python-chinese在lists.python.cn
> *Subject:* Re: [python-chinese] ×Ö·û´®,µ±ÕûÐÍÀ´´¦Àí??
>
> eval °É
>
> On 6/25/07, Neo Chen <openunix在163.com> wrote:
> >
> >  "9/5" ×Ö·û´®.
> >
> > ÎÒÏë¼ÆËã 9/5 = 1.8 ??
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
>  ------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
ÈËÉú¾ÍÏñÒ»¸öÆ¿×Ó£¬¶øÉú»î¾ÍÊÇÆ¿×ÓÀïµÄË®¡£
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070626/e3db7321/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号