[Tutor] Integer to binary
Hello, Is there a function that converts from integer to binary (or a module that handles this)? The only thing close to it that i found in the manual is the binascii module but i can't get it to work. Thanks Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] How to import modules using the input() command
Hello, I was wondering if there is a way to import modules using the input() command. If i try to do it directly it gives me an error: >>> input() import time Traceback (most recent call last): File "", line 1, in input() File "", line 1 import time ^ SyntaxError: invalid syntax >>> Is there another way in which i can import modules with the input() command? Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Having trouble with " table % listTable.values() " line
Hello, This is my first post so if i make any kind of mistakes take it easy on me :). I don't know how to explain clearly what is the problem but i'll try. table = """ %s |%s |%s --- %s |%s |%s --- %s |%s |%s """ listTable is a dictionary. listTable = {0 :'X', 1 :' ' , 2 :' ', 3 :'O', 4 :' ', 5 :' ', 6 :'O', 7 :' ', 8 :'X',} I am trying to take the values from the dictionary listTable.values() and print them in the table. The problem is that listTable.values() returns a list " ['X', ' ', ' ', 'O', ' ', ' ', 'O', ' ', 'X'] " and python won't assign the values of the dictionary in the table. " table % listTable.values() " This error message appears: Traceback (most recent call last): File "", line 1, in table % listTable.values() TypeError: not enough arguments for format string So instead of the list " ['X', ' ', ' ', 'O', ' ', ' ', 'O', ' ', 'X'] " which won't let me assign strings in the table, i want to get ('X', ' ', ' ', 'O', ' ', ' ', 'O', ' ', 'X') from listTable.values() I know i can make it work using: table % (listTable[0],listTable[1], listTable[2],listTable[3],listTable[4], listTable[5],listTable[6],listTable[7],listTable[8]) but it's kinda long. If somebody can tell me how to convert the []list into () i'll make him a little shrine and worship him for 5 seconds :P I'm trying to make a OXO game, so don't give me any hints even if you spot mistakes (i hope i can make it alone) Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Writing a list in a text file
Hello def saveBugs(data): store = open(filename, 'w') for timeMark,aList in data.items(): store.write(timeMark + '\n') store.write(aList + '\n') store.close() data is a dictionary aList is a list After i run this part the following error pops up: Traceback (most recent call last): File "C:\Python\Bugs.py", line 133, in main() File "C:\Python\Bugs.py", line 130, in main saveBugs(dataBugs) File "C:\Python\Bugs.py", line 17, in saveBugs store.write(aList + '\n') TypeError: can only concatenate list (not "str") to list Can anybody tell me how to make it work Yahoo! Music Unlimited Access over 1 million songs. http://music.yahoo.com/unlimited ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Starting a .py file from Idle
Hello, Can anyone tell me how to start a program directly from the interpreter (i'm using IDLE). Usually i open a new window , write the lines of code and press F5 to run the program in the interpreter. The problem is that i need to to that directly from the interpreter. (I'm running windows). Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor