-
Replied To a Post in How to print Pig Latin in Pig Latin?
If you want to translate more than one sentence, you can use a loop if __name__ == "__main__": while True: x = main() print(x) -
Replied To a Post in How To Create A 2D Coordinate Grid In Python
You can get this with coordinates = [(i, j) for j in range(11) for i in range(11)] although many programmers would use numpy for such tasks. -
Replied To a Post in How To Create A 2D Coordinate Grid In Python
You're running out of memory because `calculatingcoords` never becomes `False`, and the loop runs forever, appending more and more items to `coordinates`. It would be easier if you give us … -
Replied To a Post in How to change file bits without reading entire file
Are you looking for a xor cipher https://en.wikipedia.org/wiki/XOR_cipher ? -
Replied To a Post in Python 2 Versus Python 3
I think these compatibility issues will exist forever. The solution is to stop using python 2.x code. The main sources of backward incompatibility are * The print statement without () … -
Replied To a Post in Python 2 Versus Python 3
If you are learning python now, learn python 3. It has been around for quite a while now, and many features have been added. If you learn python 2, you … -
Replied To a Post in draw a triangle and its median?
Where did you copy and paste this code ? There are many errors: `trutle`, `tirangle`, also what is the `triangle` object, and the method `triangle.setFill` etc ? Start with a … -
Replied To a Post in Websocket Server Problem
According to the documentation, the module requires a python version >= 3.4. I'm afraid it won't run on your python 2.7. I hope somebody else can help you because I … -
Replied To a Post in Websocket Server Problem
You could perhaps start with an example similar to the "getting started" part of the [websocket documentation](https://websockets.readthedocs.io/en/stable/intro.html) -
Replied To a Post in PDF file: Access denied
In linux, there are programs such as `file` or `kmimetypefinder` to help guess the type of a file, for example here is a sequence of commands $ mv x.zip x.pdf … -
Replied To a Post in AttributeError: module 'pandas' has no attribute 'read_csv'
This is annoying. Mine says print(pd) <module 'pandas' from '/usr/local/lib/python3.4/dist-packages/pandas/__init__.py'> I don't understand where your pandas module comes from. Can you try print(pd.__file__) Also is there a file named `pandas.py` … -
Replied To a Post in AttributeError: module 'pandas' has no attribute 'read_csv'
Try `print(pd)` to see where this pandas comes from. -
Replied To a Post in group tuple values with tolerance and average
@JamesCherrill In your example my 'key' algorithm groups the 3s and the 5s in a one-liner because the keys x//3 for the values (1, 3, 3, 5 ,5, 5, 5) … -
Replied To a Post in group tuple values with tolerance and average
Or perhaps you could try n = len(set((x//tol, y//tol) for (x, y) in data)) as a rough estimate of the number of clusters. -
Replied To a Post in group tuple values with tolerance and average
I don't know this cluster module. The number of clusters can probably be determined by * The shape of the clusters * Your tolerance * The minimum and maximum values … -
Replied To a Post in how generate dictionary from checkbutton
There is a good example at the bottom of this page http://www.python-course.eu/tkinter_checkboxes.php . Take the time to read about the use of tkinter Variable classes. -
Replied To a Post in group tuple values with tolerance and average
You could try to compute a key for each pair `(x, y)`, the key could be `(x//3, y//3)` for a tolerance of 3. Then you sort the data by the … -
Replied To a Post in Sync local folder with FTP folder
I suggest a bash script #!/bin/bash while true; do lftp -f /path/to/lftp-script sleep 300 done lftp is a very good way to sync a local folder with an FTP folder. -
Replied To a Post in I have a problem with bootloader , it does not appear!!
Go to this site https://sourceforge.net/projects/boot-repair-cd/ , download and burn the boot-repair-disk, then reboot the computer on the boot-repair disk, click on the displayed button and let the disk repair your … -
Replied To a Post in Resolve a lineare systeme n*m in C
Rosetta Code has a solution in 27 programming languages https://rosettacode.org/wiki/Gaussian_elimination I didn't test them ... Also, it may work only for square matrices. -
Replied To a Post in How to re-start a loop in Python?
You can exit the loop with a `break` statement or by setting start to another value, for example `start = "Don't start"`. -
Replied To a Post in How to re-start a loop in Python?
You could replace line 7 with while start == 'Start': and remove the `for loop in start`, which is not good: loop takes the values 'S', 't', 'a', 'r', 't', then … -
Replied To a Post in Getting an input from arrow keys.
@The_6 This thread is 6 years old, I guess AutoPython moved to another project since then. Please don't revive old threads, start new ones instead ! -
Replied To a Post in Python 3 md5 error
This file is not the file hashlib.py from the python's standard library. You could rename it (for example myhashlib.py). Make sure that there are no hashlib.pyc or hashlib.pyw in the … -
Replied To a Post in Python 3 md5 error
You may be shadowing the standard lib's hashlib module with another module with the same name. Try import hashlib print(hashlib) -
Replied To a Post in A contact database using a dynamic-single linked list in ANSI C
Majestic0100 is probably working on another project now as this thread was started 8 years ago! -
Replied To a Post in Python TKinter delay hangs using after method
In this new version, the pausing method only generates integers to specify the number of milliseconds to pause. The calls to `after()` are handled by a wrapper class from tkinter … -
Replied To a Post in Python TKinter delay hangs using after method
A still better idea uses a generator (tested with python 3) : from tkinter import * class Helper: __name__ = 'Helper' def __init__(self, func, *args, **kwargs): self.gen = func(self.sleep, *args, … -
Replied To a Post in Python TKinter delay hangs using after method
There are probably several ways to accomplish this, for example def method(self, step, a, b): if step == 'start': do_something(a, b) root.after(2000, self.method, 'again', a, b) elif step == 'again': … -
Replied To a Post in graphuc design
Who told you it is important ? -
Replied To a Post in Python TKinter delay hangs using after method
You probably want to call `after()` with a method argument class App: def test(self): print('hello') root.after(10000, self.endoftest) def endoftest(self): print('world') -
Replied To a Post in rsync error
The mkstemp C function failed to create a temporary directory (see `man mkstemp`). The yr2Xyc looks like a string generated by mkstemp according to this documentation. The question is why … -
Replied To a Post in Python subprocess interact cmd with administrator rights
It is very difficult to run an interactive session with the subprocess module. Some of your statements look suspicious, such as `prog.stdout.read()` instead of `prog.stdout.readline()` to read a single line, … -
Replied To a Post in Python sqlalchemy error
Look at the example [Click Here](http://docs.sqlalchemy.org/en/latest/orm/backref.html). Obviously the `back_populates` value must be the name of one of the other classes attributes. -
Replied To a Post in File not transfferring to client. (Python)
The main issue IMHO is that you open the file in mode "wb+" instead of "rb" on the server side. You may have erased some files with this. Also note … -
Replied To a Post in Installing pymongo package to paython 3.5
If you're in windows, try the version from Christoph Gohlke's site [Click Here](http://www.lfd.uci.edu/~gohlke/pythonlibs/) ! -
Replied To a Post in With Python
You could also start by reading this Howto from the python documentation [Click Here](https://docs.python.org/3.5/howto/webservers.html) -
Replied To a Post in Python PySFTP
Perhaps you need the cryptography module [Click Here](https://pypi.python.org/pypi/cryptography) ? -
Replied To a Post in Python 2 vs. Python 3
I don't think studying my code snippets is good way to learn python. Most of them deal with specialized tips and tricks. More seriously, you could visit [the hitchiker's guide … -
Replied To a Post in Python 2 vs. Python 3
A crash course for unicode from, to bytes (works in 2 and 3, only the 'str' class in 3 is named 'unicode' in 2, and the 'byte' class in 3 … -
Replied To a Post in Python 2 vs. Python 3
Among the various reasons why some people stick with python 2 is the fact that many linux distributions still come with python 2 as their default python interpreter, because many … -
Replied To a Post in How to handle Error Handling
In python, there is an awesome **else** part in the try statement, so you can write for example try: f = open('foo.txt', 'w') except OSError: print('could not open file') else: … -
Replied To a Post in Synsets in Wordnet for NLTK
I'm getting this output on kubuntu with python 2.7, with almost the same code ========================================== Compare this with the dynamic case when the data is changing , for example watching … -
Replied To a Post in Synsets in Wordnet for NLTK
But what is the input file ? -
Replied To a Post in Synsets in Wordnet for NLTK
If you can attach `answer_token.txt` to a post, I could try the code. -
Replied To a Post in Synsets in Wordnet for NLTK
It seems to me that there is an indention error at line 11. Line 11 should be in the `for b` loop. -
Gave Reputation to JasonHippy in Having persistent stty settings
> Of course, you need to restart bash after modifying ~/.bashrc. Actually you don't have to restart bash at all. You can re-load/re-source any of the changed config files in … -
Replied To a Post in Problem Using Python Socket Server
Can you post the whole error message ? Edit: this is unrelated to the issue, but if you want to run the program several times, it would be good to … -
Replied To a Post in Having persistent stty settings
You could try the answer here [Click Here](http://superuser.com/questions/212446/binding-backward-kill-word-to-ctrlw) using `"\C-i"` instead of `"\C-w"`. Of course, you need to restart bash after modifying `~/.bashrc`. -
Replied To a Post in Getting Ubuntu Server Virtual Machine to allow scrolling through output
It should be relatively easy to enable access to USB devices from the ubuntu server. In the machine configuration, activate the USB controler and the USB 2.0 controler, then add …
The End.