2,646 Posted Topics
Re: We can help, but we cannot do your homework for you. Find the ciphered version of the word `'hello'`, then try to compute it with the dictionary. | |
Re: It is very difficult to understand how the expected output is connected to the input. Can you explain this ? Also why did you post this in four different forums (python, java, C, C++)? What do you want exactly ? | |
Re: I don't know Runestone Interactive. About languages, my personal opinion is that you are wasting your time learning perl at the same time as python. Both languages can be used for the same tasks and you will end up not using perl because it is older and harder to use … | |
Re: A regex to match more than 1 space character is r' {2,}' To match a dot followed by a letter without consuming the letter, you can use r'\.(?=[a-zA-Z])' Always use raw strings(`r'...'`) with regexes, in order to preserve `\` characters. | |
Re: In ubuntu there is a package `python-enum34` for this, together with 3 other enum packages for python. | |
Re: You can avoid many calls to `print()` by printing multiline strings such as banner = ''' _____ ____ | ___|__ ___ | __ ) __ _ _ __ | |_ / _ \ / _ \| _ \ / _` | '__| | _| (_) | (_) | |_) | … | |
Re: Here is a recursive solution def generate_n_chars(n, c): if n == 0: return '' n, r = divmod(n, 2) s = generate_n_chars(n, c) return s + s + c if r else s + s | |
Re: Another solution, using the `any()` builtin function def is_member(x, a): return any(item == x for item in a) | |
Re: For a string, the following function works def length(s): return 1 + s.rfind(s[-1]) if s else 0 It fails for a list because the list type has no method `rfind()`. The following works for a list def length(alist): x = object() alist.append(x) result = alist.index(x) del alist[-1] return result | |
Re: This is a link to a page with windows driver. It seems safer to download them from the [HP web site](http://h10025.www1.hp.com/ewfrf/wc/product?cc=us&lc=en&dlc=en&tmp_geoLoc=true&product=3742086) directly. For linux drivers, I would start [here](http://hplipopensource.com) at hplip web site. This thread is 3 years old, stupendousomega probably found a driver for his printer since then ;) | |
Re: I think you could add a launcher to the explorer's context menu by following [this tutorial](http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/). | |
Re: I bought three Acer Aspire laptops with i7 and i5 processors. They were sold with windows 8, which I replaced with kubuntu 64 bits and they work very well. | |
Re: This page [Click Here](https://en.wikipedia.org/wiki/Numerical_approximations_of_π) contains many formulas. I suggest to start with Ramanujan's formula. | |
Re: Everybody has his/her favorite language. What we lack is an objective criterion to define *the best* language. It's an ill posed problem. You can 1. google what is the best programming language. 2. Think about something else. Python is a very good general purpose language, from a technical point of … | |
Re: In this well known page about Sudoku [Click Here](http://norvig.com/sudoku.html), Peter Norvig draws boards of numbers in a console simply by printing convenient strings of characters. Try to print one of his boards, it should give you ideas for your own boards. | |
Re: Karl Popper invented the notion of [falsifiability](https://en.wikipedia.org/wiki/Falsifiability) in his extraordinary discussion on the meaning of truth. Following this idea, to make sure that answers are correct, try to refute them by all the means. If they resist all your attempts, you can describe them as correct. | |
Re: You say that it won't work, but what is the output ? | |
Re: I don't know ESX, but in principle, if you can describe precisely how to do it manually, python should be able to do it. | |
Re: The first error I see is that line 7 should be [icode]n = node()[/icode]. | |
![]() | Re: Python says `5.16294852309750916500022794327 e287193` and `6.74114012549907340226906510470 e315652`. For example Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from scipy.misc import factorial >>> x = factorial(65536, exact=True) >>> s = str(x) >>> s[-1] '0' >>> s[:30] '516294852309750916500022794327' >>> … |
Re: Apparently, there is a fuzzy logic toolbox for Scilab as these links tend to prove * [Item One](https://burubaxair.wordpress.com/2013/09/26/fuzzy-logic-in-scilab-sciflt-part-1-mamdani/) * [Item Two](https://atoms.scilab.org/toolboxes/sciFLT) Scilab is free software under CeCILL license and it is very close to Matlab. There is also a python module called sciscipy to connect python to scilab. Apart from … | |
Re: Wouldn't that mean storing the master password somewhere in the file system and compromise security ? | |
Re: I have a running version for scilab here. I didn't check that the numerical result is good however clear; function func = foo(z, x) func = ((0.6369).*sin(z.*sin(x)).*sin(x)) endfunction function simpson = simpson(f, a, b, n) h = (b-a)/n; i = 0; fks = 0.0; while (i<=n) xk = a+i*h; if … | |
Re: Algorithmically, you're reading groups of lines and printing output for this group when it's finished. Pseudo code looks like current_group = None for line in file: group <- extract group from line if group != current_group: # we're starting a new group if current_group is not None: print current_group output … | |
Re: Here is a python script, if you have python #!/usr/bin/env python # -*-coding: utf8-*- from __future__ import (absolute_import, division, print_function, unicode_literals) __doc__ = ''' ''' import argparse import os def main(args): d = args.directory for n in os.listdir(d): f = os.path.join(d, n) if os.path.islink(f): os.unlink(f) if __name__ == '__main__': parser … | |
Re: I suggest to uninstall PIL (or pillow) and reinstall Pillow‑2.6.1.win‑amd64‑py3.4.exe from [Gohlke's site](http://www.lfd.uci.edu/~gohlke/pythonlibs/). | |
Re: > I want to print for each title outside of the loop. This is meaningless. It does not matter if the titles are printed inside or outside of the loop (which loop ? why ?) as long as the program prints the correct output. Change your priorities: first the program … | |
Re: Use print('{0:.2f}% $ {1:.2f} $ {2:.2f} $ {3:.2f}'.format( ratea, principal, simple, compound)) see [Click Here](https://www.daniweb.com/software-development/python/code/232375/string-formatting-specifications). | |
Re: You can create a list of numbers >>> L = range(4128, 4616) >>> L = [x for x in L if (x-4128) % 70 != 69] >>> L [4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, … | |
Re: Independently from the python part, I don't understand what you want to do. Can you explain the problem in details. | |
Re: In CPython, `Socket.recv()` is implemented by calling the C function ssize_t recv(int sockfd, void *buf, size_t len, int flags); You can see this by downloading the python source code and looking into `socketmodule.c`, or online [here](https://hg.python.org/cpython/file/9c35973829e6/Modules/socketmodule.c). Before calling the C function, python allocates a buffer which capacity is bufsize (4096 in … | |
![]() | Re: I have 2 Toyotas: a Prius, great great great hybrid car ! and an Aygo. |
Re: You can make it a helper function for a function which acts on a full text: def _space_to_tab(work_string): """Replace spaces with tab at the beginning of a line of text """ s_to_tab = 4 whitespace = work_string[ : len(work_string) - len(work_string.lstrip())] whitespace = whitespace.replace(REAL_SPACE * s_to_tab, REAL_TAB) whitespace = whitespace.lstrip(REAL_SPACE) … | |
Re: It means a string representing the file system path to the file or directory `.xsend` in your home directory. A better way to obtain it is os.path.join(os.path.expanduser('~'), '.xsend') This code is better because it is cross-platform. | |
Re: Sometimes there are errors in a postscript or pdf document. There are several things you can try. If you can open the document with several programs, it may print with one of these programs and not with another. For example a pdf may print from a qpdfview window but not … | |
Re: I don't dare execute your test line now. | |
Re: On my computer, I found .tdb files in `~/.config/pulse` and `~/.cache/rhythmbox/album-art`. There is also a module `python-tdb`. I was able to open my tdb files in the python interpreter: import tdb t = tdb.open('foobar.tdb') print(list(t.iterkeys())) Backup your file first :). | |
Re: I would use something like this. This code assumes that lines starting with `'` contain values and the other lines are folder lines. def filter(lines): last = None for line in lines: line = line.rstrip() if line.startswith("'"): if last is not None: yield last last = None yield line else: … | |
Re: If you do `>>> help(chr)` in python 3, you get Help on built-in function chr in module builtins: chr(...) chr(i) -> Unicode character Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff. Now we can get a set of numbers with >>> s = … | |
Re: One of my bad habits is to use the mouse when there is a keyboard shortcut to do the same task. My hand reaches the mouse before my brain has the time to recall the shortcut. This is counterweighted by the good habit of having a mouse on each side … ![]() | |
Re: This program may help # -*-coding: utf8-*- __doc__ = ''' ''' import sys S4 = " " * 4 def main(): while True: line = sys.stdin.readline() if not line: break result = line.replace('\t', S4) print(result, end='') if __name__ == '__main__': main() | |
Re: Start with > Write a program that asks the user to enter a series of 20 numbers. then post your code in this thread :) | |
Re: `b64encode()` return a bytes. Convert it to str with decode result = base64.b64encode(username).decode('utf8')+'\n' Notice that `result` has type `str`, while `username` is a `bytes`. I suggest not to use the same variable name in order to avoid type confusion. | |
Re: Try sudo apt-get install trash-cli It works for me in kde, providing commands trash-put trash-empty trash-list restore-trash See [Click Here](https://pypi.python.org/pypi/trash-cli/). | |
Re: I did not read it, but here is an appetizing guide [Click Here](http://www.tldp.org/LDP/abs/html/) | |
Re: Don't print directly, use strings operations to create new strings with your data instead, for example >>> args = (1,2,3,4) >>> L = [str(n) for n in args] >>> L ['1', '2', '3', '4'] >>> s = '+'.join(L) >>> s '1+2+3+4' | |
Re: The menu logo at the bottom left corner looks like a clover. I search a distro with a clover logo and I found fuduntu linux which has a very similar logo. The colors seem different however. | |
Re: The main drawback of ipython's notebook is its limited editing capabilities. A web browser is far from being as responsive as an IDE and most code editing features are missing. |
The End.