trying to learn python - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: trying to learn python (/showthread.php?tid=25710) Pages:
1
2
|
trying to learn python - ocwasere - 2007-04-07 hello i am trying to learn python i was doing ok can somone please tell me why this don't work from 5.6 Looping Techniques thanks knights = {'gallahad': 'the pure', 'robin': 'the brave'} for k, v in knights.iteritems(): print k, v i get this error 19:18:02 M: 36392960 INFO: Q:\scripts\test.py 19:18:02 M: 36392960 INFO: ", line 19:18:02 M: 36392960 INFO: 13 19:18:02 M: 36392960 INFO: 19:18:02 M: 36392960 INFO: 19:18:02 M: 36392960 INFO: for k, v in knights.iteritems(): 19:18:02 M: 36392960 INFO: 19:18:02 M: 36392960 INFO: ^ 19:18:02 M: 36392960 INFO: SyntaxError 19:18:02 M: 36392960 INFO: : 19:18:02 M: 36392960 INFO: invalid syntax getting there - ocwasere - 2007-04-07 got it to work from a funtion but Code: knights={'gallahad': 'the pure', 'robin': 'the brave'} - Nuka1195 - 2007-04-07 indentation - ocwasere - 2007-04-07 Nuka1195 Wrote:indentation thanks for your reply i have had the indentation error and corrected it but this error is invalid syntax can i ask another quesion why doesn't a directory keep its order params = {"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} print params.items() [('pwd', 'secret'), ('database', 'master'), ('uid', 'sa'), ('server', 'mpilgrim')] - ocwasere - 2007-04-08 ocwasere Wrote:why doesn't a directory keep its order found out why here Python Dictionaries don't have order - ocwasere - 2007-04-08 please can you tell me whats wrong with the indentation of the code in red Code: knights={'gallahad': 'the pure', 'robin': 'the brave'} - matthuisman - 2007-04-08 get a great program called "PyScripter" - this checks ur code for syntax + indentation errors :-) - ocwasere - 2007-04-08 stanley87 Wrote:get a great program called "PyScripter" - this checks ur code for syntax + indentation errors thanks for the link, but i have not got python installed on my pc i am using notepad and the xbmc log file can you tell me whats wrong with the indentation for the code in red thanks - Nuka1195 - 2007-04-08 the code in red is commented out, so unless you post it the exact way you want, how could we possible tell you. maybe it's a mix of tabs and spaces. - ocwasere - 2007-04-08 Nuka1195 Wrote:the code in red is commented out, so unless you post it the exact way you want, how could we possible tell you. maybe it's a mix of tabs and spaces. thanks again for your reply to rephase my question should the for loop statement in red work if so can you tell me whats wrong with it thanks Code: knights={'gallahad': 'the pure', 'robin': 'the brave'} what a difference a day makes - ocwasere - 2007-04-08 big thanks to Nuka1195 for making me look at indentation big thanks to stanley87 for making me look at PyScripter i have now install python and got Alexpoet's XBMC Emulator Scripts working what a difference a day makes question to stanley87 when i close PyScripter after using this code blow i get "PyScripter.exe has encountered a problem and needs to close. We are sorry for the inconvenience." but it run fine in the pythons IDLE just wondering if you have encountered any problems with PyScripter. other than the error when i close PyScripter its cool. thanks for making me see the light Code: knights={'gallahad': 'the pure', 'robin': 'the brave'} - Nuka1195 - 2007-04-08 i would get a hold of XBMC_PC.exe (T3ch builds include it) and use that to test scripts that run in XBMC. - ocwasere - 2007-04-08 Nuka1195 Wrote:i would get a hold of XBMC_PC.exe (T3ch builds include it) and use that to test scripts that run in XBMC. thanks i will try that later to night going to sit in the garden to get some rays now been playing with XBMC Emulator Scripts now thats cool is XBMC_PC.exe like that any links for help setting XBMC_PC.exe up or is it get and go - matthuisman - 2007-04-09 XBMC_PC.exe = XBMC running on your PC - its not a full port but very good for testing scripts and skins. - zimberto - 2007-05-14 XBMC_PC.exe isn't in the fat 2.0.1 T3CH distro. :confused2: |