tailieunhanh - Advance Praise for Head First Python Part 7
Test Drive Hãy xác nhận rằng thiết lập Android của bạn là làm việc. Với các ứng dụng SL4A mở, bạn chỉ cần gõ vào tên của kịch bản của bạn để chạy nó, và sau đó nhấp vào bánh xe chạy từ trình đơn. | mobile app development ĨQST Drive-------------------------------------- Let s confirm that your Android setup is working. With the SL4A app open simply tap on your script s name to run it and then click the run wheel from the menu. Cliek a s A Your Android emulator with SL4A is working and it s running your Python M W5 code. works you are here 4 265 what to do Define your app s requirements Let s think a little bit about what your Android app needs to do. Nothing s really just have to get the web data onto the phone. o Frank Well. .first off the view code no longer has to generate HTML so that makes things interesting. Jill In fact you need the web server only to supply your data on request not all that generated HTML. Joe Ah ha I ve solved it. Just send the pickle with all the data from the server to the Android phone. It can t be all that hard can it Jill Sorry guys that ll cause problems. The pickle format used by Python 3 is incompatible with Python 2. You ll certainly be able to send the pickle to the phone but the phone s Python won t be able to work with the data in the pickle. Frank are our options then Plain data Joe Hey good idea just send the data as one big string and parse it on the phone. Sounds like a workable solution right Jill No that s a potential disaster because you never know in what format that stringed data will arrive. You need an data interchange format something like XML or JSON. Frank ve heard XML is a hound to work it s probably overkill for this simple app. What s the deal with JSON Joe Yes of course I keep hearing about JSON. I think they use it in lots of different places on the Web especially with AJAX. Frank Oh XML JSON and now think my brain might just explode here. Jill Never worry you only need to know JSON. In fact you don t even need to worry about understandingJSON at all you just need to know how to use it. And guess what JSON comes standard with Python 2 and with .
đang nạp các trang xem trước