3,386 Posted Topics
Re: Yes you need CherryPy/webPy stuff to use Python in files or you can do Python script outputting Html statements, but then you would end up reinventing the wheel. For shell scripting I think IPython is quite interesting: [url]http://ipython.org/ipython-doc/rel-0.11/whatsnew/version0.11.html[/url] | |
Re: Problem + Effort + DaniWeb = Learning For F1 click Daniweb -> Create new thread I was part of problem now solution -- Member of Month DaniWeb | |
Re: Here is something to get you started: [CODE] # imports (None) # global data days_in_months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] days_before = dict((m, sum(days_in_months[:ind])) for ind, m in … | |
Re: You try to use comma instead of colon for string slice. Why you don't use for loop to iterate input list? | |
Re: From where is the value of i coming? Push CODE button before pasting your code. | |
Re: You producing random numbers inside tight loop. You should produce data ready in main code not to mix up timing. | |
Re: Luckyly you found DaniWeb and we have here our Dr. Gribouillis, who wrote us nice class to help us out: [url]http://www.daniweb.com/software-development/python/code/257449[/url] It uses subprocess.popen, the import is little hiding inside the class for encapsulation. | |
Re: Clearly the lines 6 until 8 need work, debug this: [CODE]noCandidates = 3 names=[] for i in range(noCandidates): names.append(input("Candidate 1:", "Candidate 2:", "Candidate 3:")) print(i+1, names[-1]) # debug [/CODE] This does not even run first, as you get error: [CODE]>>> Traceback (most recent call last): File "I:\test\t_inp.py", line 4, in … | |
Re: No, 10 squared is 100. And using E instead of in symbol is little confusing, 'in' whould be clearer. Check again. | |
Re: I do not know if this would be worth a try, it at least support newer 2.0 version also. This is a Google answer though, never used it. I do not know if it work for Python3. It has quite a few promising examples on the page, though. [url]https://github.com/ryanhorn/tyoiOAuth2[/url] | |
Re: What is randomIndex =randrange(PeopleCount, VerbCount, AdverbCount, LocationCount, TimeCount) Supposed to mean does not make sense for me, and wouldn't it be easier to use random.choice from each list? Notice the (CODE) button on tool bar, next time push that beside pasting (I do not know how you got last ')' … | |
Re: I have not such old Python, but for me works normally in Windows: [CODE]# -*- coding: cp1252 -*- print(u"£") [/CODE] [CODE]Microsoft Windows XP [versio 5.1.2600] (C) Copyright 1985 - 2001 Microsoft Corp. I:\test>pound_sign_test.py £[/CODE] | |
The need for efficient storing of IP numbers came up in discussion thread. With help of this conversion to/from the 32 bit numbers that IP numbers (the old ones) represent I could push the time of finding unique IP numbers from 10 million random numbers down to under two minutes … | |
Re: You must first show effort yourself, then you can ask help if you get stuck. | |
Re: Welcome to post any Python related problems to Python forum, here you can discuss the RAPTOR stuff. | |
Re: Where are you closing the file? | |
Re: Here is a tutorial which looks about right, I am little rusty on this stuff myself. [url]http://www.learn-programming.za.net/programming_pascal_learn13.html[/url] Notice that in Pascal you can not do pointer arithmetic. | |
Re: I would just try to open any sure to be up url in try statement inside while True loop. In else statement of try I would put activity for internet open. Most likely a function call. | |
Re: time.clock() gives more accurate time in Windows. | |
Re: If you want to change the file you read the values, do changes in memory and save to file again. [CODE]import math class Grid(list): def __init__(self, cell_value=0, width = 10, height = 10): list.__init__(self, [[cell_value for _ in range(width)] for _ in range(height)]) self.cell_value = cell_value def save(self, fname): with … | |
I participated discussion about complex numbers and did some experiments in Python. I do not understand this behaviour (same behavious in 2.7.2 and 3.2.2): [CODE] >>> -(0+1j) (-0-1j) >>> -(0+1j)==-1j True >>> -(0+1j)+0 -1j >>> -(0+1j)-0 (-0-1j) >>>[/CODE] EDIT: Further investigation shows that there is -0.0 in Python, is this … | |
Re: What is the purpose of the variable and the while loop? | |
Re: Are you sure you have monocrome bitmap, I thought it must be .xbm format. Did you try to put '@' in front of file name, some net places mention it. [url]http://epydoc.sourceforge.net/stdlib/Tkinter.Wm-class.html#wm_iconbitmap[/url] mention .ico only for default parameter for Windows. | |
Re: Please do not handle HTML with regular expressions, use proper tools like Beautiful Soup [url]http://www.crummy.com/software/BeautifulSoup/[/url] Dictionary has only limit amount of memory, I think, here proof: [CODE]Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> big … | |
Re: The regex differs from globbing in that * and + modify previous symbol and any chatacter is . not ?. So p+ matches any number of p's at least one ie p, pp, ppp, .... Look for special symbols starting with \ to put suitable one between p and + … | |
Re: You are using variable at line 5 and taking input at line 6, do you see anything wrong? | |
Re: Can't you use CGI (Python) script instead of htm file? | |
Re: Many of us have done some experiments with pyQT4 and pySide. See vegaseat's GUI sticky thread. | |
Re: You can use ordereddict if you want to remember the order of entry. Is your data in sorted like it looks? So you woild end up with ordereddict of dicts/ordereddicts/defaultdict(int) of counts of things. | |
Re: Not book, but as you are using internet in order to participate this forum here is nowadays version in net: [url]http://computer.howstuffworks.com/[/url] | |
![]() | Re: If you are running from Python2, you can do [iCODE]execfile[/iCODE] command from IDLE, but easier is just open the file and push F5 from IDLE. I am fond myself on conText text editor in Windows and invoking running script externally. IDLE sometimes disturbs function of programs, so at end it … |
Re: You could store uncompressed bmp by the class that is in my mandelbrot snippet. There does indeed seem to be unofficial PIL existing for Python3: [url]http://stackoverflow.com/questions/3896286/image-library-for-python-3[/url] (as well as some alternatives) | |
Re: See my signature for ideas. | |
Re: Short fix would be to return lambda, but that surely is not the cleanest way. | |
Re: Your code looks ununderstandable, messed up indention? | |
Re: [QUOTE=cwarn23;1653554]According to my extensive knowledge of math (below are the symbols at wikipedia) the two equations will yield two different results. The --> symbol is the same is the Assembly code "if xxxxxx then" where the xxxxxx is what is before the --> symbol. So by changing the if statement … | |
Re: We are awaiting for you code curiously, do not forget CODE button. ![]() | |
Re: CODE tags would help enormously to understand your code. Either select code first and click the button or (usually easier for me) click button and right after do paste. You might want to read this highly regarded blog about the module imaplib: http://www.doughellmann.com/PyMOTW/imaplib | |
Re: For me it would go long way just to daniweb to recognize mobile browser and leave out Forums, Threads words out of down menu, and maybe be able to move it up as touch screen control buttoms are down over the menu in Nokia E7 'Anna' update. Off course Home … | |
Re: You could also be looking prime factors instead of divisor. Prime factors of 12 are 2, 2 and 3, divisors are 1, 2, 4, 6 and 12. You must be clear what is the request. | |
Re: Collect tuples of column index, value from columns with required value. | |
Learned about hook functions [URL="http://www.daniweb.com/software-development/python/threads/383164/1650339#post1650339"]for a thread[/URL] having problem with bad user input from the documentation. This is result which skips bad inputs. | |
Re: You must program on your level raising it little by little. Can you give example of easy program you finished until working condition and hardest program you did until now? Have you not been able to finish any program? Have you done some programs suggested in sticky threads in begining … | |
Re: Yes, as 21=3*7, we can say for sure that your program has problem QED. | |
Re: I do not know how to estimate your effort, but here it goes: [CODE]diff = [(ind, s1, s2) for ind, (s1, s2) in enumerate(zip(seq1, seq2)) if s1 != s2] for info in diff: place = info[0] // 3 * 3 print('Difference at %3i triple starts from %3i: %r %r' % … | |
Re: I do not see problem running them by import from main script. This would not work if you need to run the modules multiple times. If that is case you must transfer the initializations to function which you can run as many times as you like. This with recervation that … | |
Re: Maybe you would like to look this class simplifying the use of system command output: [url]http://www.daniweb.com/software-development/python/code/257449[/url] (Maybe you could benefit from reading my post linked in my signature) | |
Inspired by password entry discussions, I did this simple entry. You must of course find safe way to store the passwords, for example hashlib ([url]http://stackoverflow.com/questions/4820043/basics-of-python-encryption-w-hashlib-sha1[/url]) or [URL="https://www.dlitz.net/software/pycrypto/"]PyCrypto[/URL] and replace the simplistic example match for real life usage. The print at line 23 is just to check the attempts and to … ![]() |
The End.