2,646 Posted Topics

Member Avatar for zelrick

A very simple thing to do is to launch a graphical disk usage analyser such as filelight or baobab.

Member Avatar for Gribouillis
0
300
Member Avatar for screenedcreamy

I'm not a Java programmer but any pythonista would answer to use the beautifulsoup library. From what I read here and there, the java equivalent is named **JSoup**. I think you could try this library.

Member Avatar for JamesCherrill
0
236
Member Avatar for hjos

You must use lists for this A = [] Y = [] val = [12, 5, -12, 1, 120, -1, 10] for i, v in enumerate(val): t = test() name = 'word_{}'.format(i) j = t.job(x=name, y=v) A.append(t) Y.append(j)

Member Avatar for Gribouillis
0
243
Member Avatar for templar77

Post your code. You don't need `__call__()` methods, you only need one `__init__()` method per class, and also `__add__()` and perhaps `__radd__()` methods.

Member Avatar for Gribouillis
0
365
Member Avatar for Karthik_4

You can get the path to the python command by pasting this in a terminal: python -c "import sys; print(sys.executable)" edit: @AndrisP what you say will only work if the python scripts start with the correct shebang line containing the call to the python executable, unless the system has been …

Member Avatar for Karthik_4
0
13K
Member Avatar for Joshua_11
Member Avatar for ALosh99

Have a look at this quickstart page [Click Here](https://docs.scipy.org/doc/numpy-dev/user/quickstart.html) explaining how to build numpy arrays.

Member Avatar for Gribouillis
0
169
Member Avatar for Mickey_2

You could write cipher = [(key[(key.index(char) + offset) % 26] if char in key else char) for char in text]

Member Avatar for Mickey_2
0
287
Member Avatar for Roger_2

For a tree with N nodes, the function will be called exactly 2N+1 times in my opinion (N times with a real node and N+1 times with a null node). You can prove this by induction on N by adding a leaf to a tree or by using the induction …

Member Avatar for Mickey_2
0
422
Member Avatar for OnlyThierry

What you can do is add print statements in the code in order to see what's getting executed. For example you can add `print(line)` at line 66 because the `interpretor()` function is supposed to be called with a line containing the game to be diplayed. You can use my `printat()` …

Member Avatar for OnlyThierry
0
3K
Member Avatar for ALosh99

I suggest def Density(rho0, r, Rc, Rd): return rho0 * np.exp(-np.maximum(r-Rc, 0)/Rd)

Member Avatar for ALosh99
0
889
Member Avatar for Mickey_2
Member Avatar for Mickey_2
0
293
Member Avatar for Mickey_2

Hello, I think you can start a long list of missing features. The first in sight are 1. A shortcut to exit the editor 2. Why is there no menubar ? Is it by design ? 3. The text area does not update as it should when the window is …

Member Avatar for John_103
0
304
Member Avatar for neerajkumar_86

I suggest a shell script [code=sh] #!/bin/sh python f4761sk3.py python f4761sk2.py python f4761sk1.py python f4761se3.py python f4761se2.py python f4761se1.py python f4761pl3.py python f4761pl2.py python f4761pl1.py python f4761no3.py python f4761no2.py python f4761no1.py python f4761nl3.py python f4761nl2.py python f4761nl1.py python f4761ie3.py python f4761ie2.py python f4761ie1.py python f4761hu3.py python f4761hu2.py python f4761hu1.py python …

Member Avatar for Gribouillis
0
2K
Member Avatar for pirulo64

You could download `subprocess.py` from the python 2.7 distribution and try to use its methods. If your server is a linux server, it may work.

Member Avatar for pirulo64
0
279
Member Avatar for Mickey_2

I can't run the script in kubuntu 14.04. I get Traceback (most recent call last): File "foo.py", line 99, in <module> clicker = Game() File "foo.py", line 11, in __init__ self.createwidgets() File "foo.py", line 90, in createwidgets self.create_styles() File "foo.py", line 15, in create_styles frame_style.theme_use('normal') File "/usr/lib/python3.4/tkinter/ttk.py", line 523, in …

Member Avatar for Mickey_2
0
5K
Member Avatar for ALosh99

Try to remove all the calls to `float()`. They are not necessary, and numpy uses its own float type.

Member Avatar for ALosh99
0
316
Member Avatar for grand_78

Your code needs an `if` statement to determine if `stu_points` is below 60 and print an F in that case.

Member Avatar for Freshly
1
545
Member Avatar for j.parkerrrr

A block of python code, showing serious attempts to solve the problem is missing in your question. Helpers here are not attending a programming course, and usually don't do student's homework for them.

Member Avatar for slate
-2
363
Member Avatar for grand_78

@hericles The comma trick works only in python 2. With python 3, `print` is a full fledged function and the way to prevent the newline is to use the parameter `end=''` in the call to `print()` .

Member Avatar for Brandon Hatch
0
204
Member Avatar for Regan_1

According to the python documentation > The combobox widget generates a <<ComboboxSelected>> virtual event when the user selects an element from the list of values. It means that you could bind this event to one of your methods mywidget.bind('<<ComboboxSelected>>', self.mymethod) Then define a method def mymethod(self, *args): print(args) and see …

Member Avatar for Regan_1
0
2K
Member Avatar for sureshk75

Hello, effbot.org says to keep a reference to the image object to prevent it from being garbage collected. You could try self.our_image = tk.PhotoImage(master=self, file="side.png") [http://effbot.org/tkinterbook/label.htm](http://effbot.org/tkinterbook/label.htm)

Member Avatar for Gribouillis
0
2K
Member Avatar for mattrweaver

What about Renaud Le Van Kim ? More seriously, I can't run your code because my python has pandas 0.13.1 in ubuntu 14.04, and this version does not understand the parameter `expand=` in `split()`.

Member Avatar for snippsat
0
3K
Member Avatar for AleMonteiro

Thanks for the link, I didn't know that. You can perhaps have windows on an external drive and run it in virtualbox. This would be a portable windows. I like the LTS versions of ubuntu, kubuntu, etc for stability. However, I still need windows now and then because some companies …

Member Avatar for BitBlt
1
632
Member Avatar for Bandit_

There is a problem in the indention of function `add_number()` at the beginning of your code. Apart from that, don't only post `ValueError`, instead, post the whole error message sent by python in your console. This error message contains most of the time the precise position in your code where …

Member Avatar for Gribouillis
0
329
Member Avatar for Karthik_4
Member Avatar for sureshk75

This works for me from tkinter import * from time import time, sleep, clock class Splash: def __init__(self, root, file, wait): self.__root = root self.__file = file self.__wait = wait + clock() def __enter__(self): # Hide the root while it is built. self.__root.withdraw() # Create components of splash screen. window …

Member Avatar for sureshk75
0
1K
Member Avatar for Kara_2

`Invalid syntax` is always a very simple error. The only strange thing in your code is the colon at the end of the line. This can happen only when the line starts with a keyword such as `if, elif, else, for, while, def, class, try, except, finally, with, lambda`. What …

Member Avatar for Gribouillis
0
319
Member Avatar for grand_78

I would remove `get_dollars()` and `get_left_over_cents()`. You can write at line 13 total_value = get_total(pennies, nickels, dimes, quarters) dollars = int(total_value) left_over_cents = int(100 * (total_value - dollars)) It seems to me that calling `get_dollars()` instead of `get_total()` at line 29 and 34 is a mistake.

Member Avatar for BustACode
0
2K
Member Avatar for Zubenna

It seems implicit to me that the code should keep argument2 unchanged and return a new value (new list or set). I suggest def manipulate_data(typename, instance): if typename == 'list': result = instance[::-1] elif typename == 'set': result = instance | set(['ANDELA','TIA','AFRICA']) elif typename == 'dictionary': result = list(instance.keys()) return …

Member Avatar for Gribouillis
0
915
Member Avatar for infovirtualser
Member Avatar for colby.christensen

The result of `if keycode == foo or bar` is probably not what you are expecting. You probably meant `if keycode in (foo, bar)`

Member Avatar for colby.christensen
0
691
Member Avatar for steven.rose.94

You could use nan from math import sqrt nan = float('nan') def mysqrt(x): return sqrt(x) if x >= 0.0 else nan See https://en.wikipedia.org/wiki/NaN Edit: Hi Tony! It's been a while... Edit2: `numpy.sqrt()` already returns nan for negative numbers! Edit3: please @steven.rose.94, use python tag as well as python3 to increase …

Member Avatar for steven.rose.94
0
347
Member Avatar for nic56208
Member Avatar for Gribouillis
0
511
Member Avatar for Arsal_1

You need to store state variables. The best thing to do is to create a class instance class App(object): def __init__(self): self.username = None self.password = None def login(self): if self.username is not None: print "Already Logged In" return u = raw_input("enter username:").strip() p = raw_input("enter password:").strip() if check_login(u, p): …

Member Avatar for Gribouillis
0
552
Member Avatar for reminem
Member Avatar for lavanyarao

The list `list(swn.senti_synsets(i,'a'))` is probably the empty list `[ ]` You could check this by printing its `repr()` for example. Your program does not (yet) handle the case where this list is empty. You must add some code.

Member Avatar for Brandon Hatch
0
326
Member Avatar for giancan

Which version of python are you using. If you are with python 2.7, a good thing to do first is to import from __future__ import unicode_literals at the top of the file, so that literal strings are automatically unicode. If it doesn't suffice, you can also try fsencoding = sys.getfilesystemencoding() …

Member Avatar for Gribouillis
0
316
Member Avatar for bumsfeld

@srujana_1 I don't have windows, but you can try and replace the lambda with lambda e: os.startfile("C:\Users\hello\Desktop\filename.pdf") Please start new threads with the tag "python" when you have different questions. edit: bugfix

Member Avatar for bucefala
0
2K
Member Avatar for eniacpx

@lavanyarao `list index out of range` is a very general message. You must post the whole error traceback to see which list is involved. Also, it is better if you start your own forum thread with the tag `python` instead of reviving an old thread.

Member Avatar for Gribouillis
0
5K
Member Avatar for Bashy345

What kind of data does the database contain ? Do you know how you want the data to appear in the file ?

Member Avatar for Gribouillis
0
390
Member Avatar for zoro007

You probably have a tuple or a list when you check more than 1 file, and a str or unicode when you check only one file. You could try val = query.getvalue("do") if isinstance(val, (str, unicode)): val = (val,) for i in val: etc In python 3, use` (bytes, str)` instead …

Member Avatar for zoro007
0
176
Member Avatar for Bashy345

You can start with this import os print('Enter a file name to save your database to.') name = input('Enter name of text file: ').strip() if name: name = os.path.expanduser(name + '.txt') if os.path.isfile(name): while True: overwrite = input("Would you like to overwrite this file? Yes or No: ") overwrite = …

Member Avatar for Gribouillis
0
274
Member Avatar for pirulo64

`os.system()` is long deprecated, and it does not return the command's ouput. [Use](https://docs.python.org/2/library/subprocess.html#subprocess.check_output) import subprocess platform = subprocess.check_output("dmidecode -s system-manufacturer", stderr=subprocess.STDOUT, shell=True) also `platform.dist()` is deprecated, use `platform.linux_distribution()`.

Member Avatar for Gribouillis
0
500
Member Avatar for pirulo64

According to [the python documentation](https://docs.python.org/2/library/platform.html?highlight=platform#platform.linux_distribution), `platform.linux_distribution()` returns a tuple `(distname, version, id)`. For example on my computer $ python -c "import platform; print(platform.linux_distribution())" ('Ubuntu', '14.04', 'trusty') What does it print on your server ?

Member Avatar for pirulo64
0
255
Member Avatar for jennga

You must call the `min()` and `max()` functions with the argument `scoreList` instead of `count`. The same holds for `sum()` print ('Minimum: ', str(min(scoreList))) print ('Maximum: ', str(max(scoreList))) You can also improve the input part: scoreList.append(int(input('Enter score {:d}/{:d}: '.format(i, count))))

Member Avatar for Gribouillis
0
3K
Member Avatar for vegaseat

Once the text item is created, you can obtain a bounding box with `canvas.bbox(item=text)`, or something similar.

Member Avatar for Mohamed_65
1
4K
Member Avatar for isla.rose.3

When python says invalid syntax, it shows a point in code near the point where there is an error File "foo.py", line 11 print("Therefore, your total shipping charge would be " total) ^ SyntaxError: invalid syntax If you look at your code at line 11, you will see the error. …

Member Avatar for ashaa
0
3K
Member Avatar for ALosh99

This code runs without error. I'm not sure it's computing what you want import numpy as np T = 5 N = 50 a= 2. # will turn the spiral v= 0.23 omega = 0.2 r0 = v/omega t=np.linspace(0,T,N+1) r= v*t #theta = a + r/r0 theta = omega*t x=r* …

Member Avatar for Gribouillis
0
4K
Member Avatar for Ross_1

It is a lot of code. It seems to me that only the main window should have a `Tk `instance as `self.GenericGui`. Other windows should probably have a `Toplevel` instance.

Member Avatar for Gribouillis
0
318

The End.