ขอถาม .item() หน่ยอครับ

  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.
  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.

my_dic = {‘thailand’:1,’Roi’:2,’bbb’:3}

for x,y in my_dic.item():

print x,y

ผมลอง ทำ ตามใน หนังสือ แต่มัน error นี้อะครับ

Traceback (most recent call last):

File “”, line 1, in

for x,y in my_dic.item():

AttributeError: ‘dict’ object has no attribute ‘item’

ใช้ python 2.5.2 ครับ

แล้วพอจะมีเว็บ แนะนำเกี่ยวกับ python มั้ยครับ คือกำลังเริ่มใช้ เป็น ภาษา c ฒานิดหน่อย นิดมากครับ

ต้องเป็น my_dic.items() มั้งครับ

ขอบคุณครับ มองไม่เห็น s > <

ย้าย Codenone

ประกาศย้าย Codenone ไปใช้ Forum ของ Blognone แทนครับ ตามไปตั้งกระทู้ต่อได้ที่ Codenone Forum (รายละเอียดอ่านจากกระทู้ ย้าย Codenone ไปรวมกับ Blognone)

กระทู้เก่าๆ จะย้ายตามไปในภายหลัง ตอนนี้ปิดการโพสต์กระทู้ไว้ เหลือไว้เฉพาะอ้างอิงเท่านั้น