3,386 Posted Topics
Re: 'qwerty'.join('""') or '"qwerty"' You should post more data of what you want to accomplish if these do not produce what you want. | |
What modules come builtin with your Python? Let's exclude the internal _ starting ones for this question. You know those? Are you sure? Good, because I did not! (Hint WindowsXP and Python2.72 has 27 builtin modules) Here the answer in code [CODE]import sys print('\n'.join(n for n in sys.builtin_module_names if not … | |
Re: I do not see any Computer Science point in your post, more like Windows question as I do not thonk InstallShield exist for other operatinbg systems. | |
Re: Try harder, your code has around 10 bugs and it does not compile because of line 10! | |
Re: Is the order of lines significant? You could read lines in from both files in one list, change values to float numbers. Sort by x.y to bring near points near each other so you do not need to compare distance of every point from each other. But what if distance … | |
Re: This one is very good: [url]http://docs.python.org/tutorial/inputoutput.html[/url] | |
Re: I would include the letter in the tuple appended to list at line 8 or do loop over count, letter tuples of frequency and letter prepared by the zip function. I would not definately use l as variable name, use full, understandable words. | |
Re: The package directory is not on path or pythonpath. What is your need for Python? Did you consider [URL="http://wiki.python.org/jython/UserGuide"]Jython[/URL]? | |
Lookup table is usually the fastest method to find function value, if number of values is small. Here we demonstrate the principle by using task of showing the value of byte as binary string or transforming binary string to byte binary value. | |
Re: Or you can install [URL="http://pypi.python.org/pypi/blist/"]blist module from pypi[/URL] and use the sorteddict. | |
Re: Seeing your backslashes I assume you operate in windows environment. Would itnot be possible to make permanent mapping to drive letter as the direct net form is not accepted everywhere. Or at least have names set up so that you do not deal directly with IP numbers, which looks clumsy. … | |
Re: The command is [iCODE]DEL[/iCODE] in Windows and[iCODE]rm[/iCODE]in Linux. And the command in text editor has usually short cut ctrl-N. | |
Concratulations for [URL="http://www.daniweb.com/members/debasisdas/149842"]debasisdas[/URL] for being chosen [URL="http://www.daniweb.com/newsletter/issue.php?date=2011-06"]member of month for November[/URL] [URL="http://www.daniweb.com/newsletter/issue.php?date=2011-04"]like me[/URL]. Don't hold your breath for [B]Featured Poster[/B] sign though, maybe some time next year, I think:icon_evil: | |
Re: I would not write objects to map. i would concider pellets only while moving PacMan. I would draw in drawing loop first existing in those cordinates: Ghost. packMan, pellet otherwice thing in map. It is not good to try to manage with only the map, you need layers. | |
Re: Windows 3.11 was considered somehow decent if you have huge memory (8 or even 16 [b]MB[/b] ;) ). | |
As 3.2 has the input bug maybe it makes sense for going with 3.1.4 (I got my computer full of zombie processes with 3.2.1rc and removed it from my WindowsXP machine) [CODE] Python 3.1.4 released Python 3.1.4 has been released. Published: Sun, 12 June 2011 13:00 -0600 [/CODE] Python 2.7 … | |
Re: You forgot the exact error message. Any of those lines with [0] would produce error if the list would be empty. | |
Re: Gribouillis' code worked for me also from WindowsXP and Python 2.7.1. I did easy_install and got version 3.2.0 | |
Re: Leave the code which you have tested to be working and restart from there testing additions to program properly. Refactor code to functions. | |
Re: I did not run your code, but checking is easier with sorted hand. Only you must first cosider the wild cards and include those for analysis. | |
Re: General way is [url]http://docs.python.org/library/configparser.html[/url] | |
Re: [QUOTE=dustbunny000;1582267]I keep getting this error: error: unable to find vcvarsall.bat What is vcvarsall.batand why do I need it? I'm new to programming. Please explain as simply as possible!! Thanks![/QUOTE] I do not see what connection your question has with Python. | |
Re: True is builtin: [CODE]>>> dir(__builtins__) ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning', 'DeprecationWarn ing', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'Generato rExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'L ookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'P endingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'Syntax Error', 'SyntaxWarning', 'SystemError', 'SystemExit', … | |
Re: In DaniWeb terms the undefined behaviour could be translated: risk getting struck by lightning by Goddess Narue ;) if you use it. | |
Re: [URL="http://www.freebookcentre.net/Cisco/ciscoCcna.html"]Cisco Press[/URL], maybe? | |
Re: Adapt my code snippet to do [B]in[/B] test for lines instead of whole file: [url]http://www.daniweb.com/software-development/python/code/316585[/url] More simple finding word in file, showing lines containing word: [CODE]fname = 'alice.txt' find = ('cat', 'queen') with open(fname) as infile: for line_no, line in enumerate(infile, 1): lline = line.lower() if any(word.lower() in lline for … | |
Re: Maybe you are trying to do Html/XML processing with wrong tools. You should use parser, not regex. | |
Re: Maybe this helps: [url]http://www.delphibasics.co.uk/RTL.asp?Name=As[/url] | |
Re: Compiler.. In C... Spew out 1s and 0s? You mean disassembler in C? | |
Re: Show what you are trying not only teacher's template. You have got the code from code snippet's and that should be more than enough help for you. | |
Re: Using cls to clear teminal is consired bad, antisocial style as you are destroying output from any previously run command. That is also only working in Windows so you make your program unportable without reason. | |
In Python Forum's intro text link to bbcode document does not work (blank page). [url]http://www.daniweb.com/software-development/python/114[/url] link: [url]http://www.daniweb.com/forums/misc-explaincode.html[/url] | |
Re: You should run it from command line as [CODE]python chext.py . foo java[/CODE] But really you should fix the function as it is not using the parameters properly: [CODE]def change_ext(directory, old_ext, new_ext): for f in os.listdir(directory): base, ext = os.path.splitext(f) if ext[1:] == old_ext: os.rename(f, "%s.%s" % (base, new_ext)) [/CODE] … | |
Re: Are you afraid to read the documentation? [url]http://pygame.org/docs/tut/SpriteIntro.html[/url] [url]http://pygame.org/project-Bouncy+Ball+tank-864-.html[/url] | |
Re: If you make distance matrix from player, it is easy for enemy to zoom in to player. Only problem is that it is too deadly. You only move one closer and check if players position is distance away in same direction, if yes no walls are between. | |
Re: Maybe help from here: [url]http://www.eonclash.com/Tutorials/Multithreading/MartinHarvey1.1/ToC.html[/url] | |
Re: You would use the output of your [URL="http://en.wikipedia.org/wiki/Tree_traversal"]tree traverse[/URL] function and construct the tree next time with your corresponding constructor from same traversal order. Also you could name the nodes and list the children of each node and identify the top node (say the first one in the list). This … | |
Re: You compiled the Python with same compiler? Compilers of Python and other parts should e same. Standard Python is compiled with Microsoft visual c++ 2008. | |
Re: If the scripts main code should be run (no if __name__ == '__main__' condition): [CODE]selection = int(raw_input('''Select one: 1) memory 2) channelmap 3) upload ''')) if selection == 1: import memory elif selection == 2: import channelmap elif selection == 3: import upload else: print('Wrong choice') [/CODE] Better way would … | |
Re: The code manipulates the structure through the passed pointer doesn't it? i think you are mistaken Oh Ancient One! Ternary operation in line 15 set node's pointer to equal p's next pointer if p is not null pointer or zero if p is zero (NULL). | |
Re: you also got literal and variable mixed us at line 23. You better consider more than allocated amount of lines or other incorrect form so use return value of reading the file. You should also give maximum length for scanf. | |
Re: The good randoness is sometimes little counterintuitive though, and I would not bet on uniformity of your random numbers. the Art of Computer Programming by Knuth is thing to read if you want scientific understanding about things. As example while getting to know about facts on Sudoku I ran accross … | |
Re: You are not saving the value returned from something to global variable, so global variable a is uninitialized. print(something()) would work or adding 'a = ' in beginning of line 5. It is good to start to practice correct naming from beginning, even I understand you are doing proof of … | |
Re: Many ways, one of cleanest is to use '\n'.join: [CODE]strings = '''First Second Third'''.split() with open('output.txt', 'w') as output: output.write('\n'.join(strings)) # print it out to test print(open('output.txt').read()) [/CODE] | |
Re: Doing == comparson with floating point number is usually very stupid. | |
Re: For me that sounds like difference of preemptive true multitasking (like Mac OS X) vs cooperative multitasking by relinquishing control during certain operatin system calls (like Mac OS 8. No I have not realy used Mac, but example is for Griswolf) | |
Re: This style of encryption is very weak. If you have patience for interesting, but very long thread we had starting from this vegaseat's snippet, I think you can benefit from this: [URL="http://www.daniweb.com/software-development/python/code/216632"]Text Encryption/Decryption with XOR (Python)[/URL] See especial my devil's advocate posts on braking the encryption:icon_twisted: | |
Re: csv does not have default column width I think, but mayby csv.writer does. If it does in the dialect you use, you can adjust it with [iCODE]csv.field_size_limit([new_limit]) Returns the current maximum field size allowed by the parser. If new_limit is given, this becomes the new limit. [/iCODE] [CODE]>>> import csv … |
The End.